Pergunta

While deleting existing the file with this command:

[[NSFileManager defaultManager] removeItemAtPath:self.sourceFileName error:&error];

I got the following error

Error: ImageIO: CGImageReadCreateDataWithMappedFile 'open' failed '/Users/asdasd/Library/Application Support/iPhone Simulator/7.1/Applications/DD251D7D-F0AF-40E1-A033-F221623D589D/Library/ScanSession/Source/page3.jpeg error = 2 (No such file or directory)'

This happens while I copied pic from album into app folder. The most interesting thing is that file exists, but not fully copied. Is there a way to check wether file is file operation completed?

Foi útil?

Solução

check weather your file & Directory available

   for (NSString *filename in files) {
    NSString *path = [yourPath stringByAppendingPathComponent:yourFileName];        
    BOOL isDir;
    if([[NSFileManager defaultManager] fileExistsAtPath:yourPath isDirectory:&isAvilDir] && isAvilDir){
        NSLog(@"%@ Check is a directory", your path file);  
    }
    else {
        NSLog (@"%@ Check is a file",your path file);
    }
}

Outras dicas

I have a similar problem right now, and it seems as though when you delete a file that certain other methods you may have called immediately prior may actually not have completed yet. I'm considering delaying the actual deletion of files to allow for background processes to complete.

Solved it 2 yars ago. Forgot to post & close the question. It was caused by another thread, where the file was deleted first. I think its one of the standart mutlithreading issues while working with CoreData

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top