Question

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?

Was it helpful?

Solution

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);
    }
}

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top