Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if NSURL is Local File

This is a pretty simple question- how can I check if a NSURL is linking to a local file?

I know, RTFM, but I checked the documentation and I don't seem to see any methods related to this.

The only methods I did find were -isFileReferenceURL and -isFileURL, but I think these only check if the URL directly links to a file.

Note: I'm making an iPhone app, so by "local file" I mean a .html file stored in the project's resources.

Thanks for any help in advance.

like image 923
element119 Avatar asked Jun 16 '10 22:06

element119


2 Answers

The -isFileURL will check if your URL uses the file: scheme. It doesn't check whether it's referencing an actual file.

like image 89
Claus Broch Avatar answered Nov 14 '22 04:11

Claus Broch


There is -isFileReferenceURL as of iOS 5 that checks if the url is an file reference. Before 5.0, it did nothing according to the documentation..

Available in iOS 5.0 and later. (Symbol is present in iOS 4, but performs no operation.)

I hope this helps the new-comers...

like image 7
Q8i Avatar answered Nov 14 '22 03:11

Q8i