views:

49

answers:

1

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?

+3  A: 

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.

Jamey Hicks