检查NSURL是否为本地文件 [英] Check if NSURL is Local File
问题描述
这是一个非常简单的问题 - 如何检查NSURL是否链接到本地文件?
This is a pretty simple question- how can I check if a NSURL is linking to a local file?
我知道,RTFM,但我检查了文档和我似乎没有看到任何与此相关的方法。
I know, RTFM, but I checked the documentation and I don't seem to see any methods related to this.
我 找到的唯一方法是 -isFileReferenceURL
和 -isFileURL
,但我认为这些只检查URL是否直接链接到文件。
The only methods I did find were -isFileReferenceURL
and -isFileURL
, but I think these only check if the URL directly links to a file.
注意:我正在制作iPhone应用程序,所以本地文件是指存储在项目资源中的.html文件。
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.
推荐答案
-isFileURL将检查您的URL是否使用file:scheme。它不会检查它是否引用了实际文件。
The -isFileURL will check if your URL uses the file: scheme. It doesn't check whether it's referencing an actual file.
这篇关于检查NSURL是否为本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!