Here is the code I am using:
NSFileManager* defaultMgr = [NSFileManager defaultManager];
if (![defaultMgr fileExistsAtPath:path]) {
return nil;
}
Where path is a url to a file on the system like: "file://localhost/private/var/mobile/Applications/blahblahblah"
This crashes with SIGABRT when the call to fileExistsAtPath: is made. The file does exist, and perhaps the string format isn't what this method would prefer, but it should just return NO. This code is part of a very popular library, and while I don't strictly need to check the existence of the path, I really want to understand what is happening here, in case I ever need to use this method directly.
Particularly:
- Is the library author using this method correctly?
- How might one catch or expect an exception from this method?
(The SDK docs don't discuss what exceptions might be thrown by this method.) - Is this a bug that I should report to Apple?
One more detail: I am running this on my iPhone 4 device with iOS 4.1