问题描述
我对Apple的NSURL类文档感到困惑.
I am confused by Apple's documentation about the NSURL class.
在NSURL中,他们说以下话:
In NSURL, they say the following:
- NSURL可以理解RFC 1808、1738和2732样式的URL
- NSURL以RFC 2396格式理解URI
他们还说RFC 2396 URI是路径.
Also they say that the RFC 2396 URI are paths.
现在这里有什么区别?路径也不是URL吗?我的意思是,这是一个地点吗?
Now what's the difference here? Isn't a path also an URL? I mean, it's an location or not?
推荐答案
URL和URI均标识资源(任何资源).但是,URL是用于标识符的术语,该标识符指定如何定位资源.
Both URLs and URIs identify resources (which are anything). However, a URL is the term used for an identifier that specifies how to locate the resource.
让我们考虑其他种类的标识符可以帮助您弄清楚这一点.ISBN代码标识一本书,但未指定如何查找.杜威十进位数字或国会图书馆编号也可以识别一本书,还可以用来组织图书馆中的书籍-只要有编号,您就可以在图书馆的书架上找到这本书.
Let's consider other kinds of identifiers to help make this clear. An ISBN code identifies a book but does not specify how to find it. A Dewey Decimal or Library of Congress number also identifies a book and is also used to organize books in a library -- given the number you can find the book on a shelf in the library.
回到URI和URL,根据定义,引用文件位置或路径的URI是URL.
Getting back to URIs and URLs, a URI that refers to the location or path of a file is by definition a URL.
NSURL还可以用于解析和处理不定位资源而仅识别资源的URI.
NSURL can also be used to parse and manipulate URIs that do not locate resources but merely identify them.
这篇关于说路径以URI表示,网络地址以URL表示是正确的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!