I am having issues on a project i've taken over for a pervious developer that got halfway through and then left - the issues is that on a particular call to save an image from a url into core data it returns the error
The operation couldn't be completed. Cocoa Error 4.
From what I can see error 4 is NSFileNoSuchFileError - the code associated with it is
if (iconURL)
{
NSURL *imageURL = [NSURL URLWithString:iconURL];
NSData *img = [NSData dataWithContentsOfURL:imageURL];
NSString *path = [self logoPath];
NSLog(@" url path %@", imageURL);
NSError *error = nil;
BOOL success = [img writeToFile:path options:0 error:&error];
if (! success) {
NSLog(@" purple monkey! %@", [error localizedDescription]);
}
}
else if ([self hasLogo])
{
NSError *error = nil;
[[NSFileManager defaultManager] removeItemAtPath:[self logoPath] error:&error];
if (error)
NSLog(@"Error removing old logo: %@", [error localizedDescription]);
}
it is throwing the error in the log that conatains the world purple monkey! - The odd thing is that it works in the original project - i have tried carious combinations of simulator, clearing simulator, running on devices etc, and still get the same result..
Thanks Guys.