Is it right to say that paths are represented as U

2019-06-12 15:34发布

I am confused by Apple's documentation about the NSURL class.

In NSURL, they say the following:

  • NSURL understands URLs in style of RFC 1808, 1738 und 2732
  • NSURL understands URIs in style of RFC 2396

Also they say that the RFC 2396 URI are paths.

Now what's the difference here? Isn't a path also an URL? I mean, it's an location or not?

1条回答
\"骚年 ilove
2楼-- · 2019-06-12 16:34

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.

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.

Getting back to URIs and URLs, a URI that refers to the location or path of a file is by definition a URL.

NSURL can also be used to parse and manipulate URIs that do not locate resources but merely identify them.

查看更多
登录 后发表回答