The correct method to convert a (file) URL to a path is path
, not
absoluteString
:
if (![[NSFileManager defaultManager] fileExistsAtPath:[url path]]) {
...
From the documentation of -[NSURL path]
:
If this URL object contains a file URL (as determined with
isFileURL
), the return value of this method is suitable for input into methods of NSFileManager or NSPathUtilities.
absoluteString
, on the other hand, returns a URL string like "file:///path/to/file".