What is the difference between paths and urls in iOS?

In a class such as NSFileManager, there are two versions of almost every method. One for paths and one for URLs. What's the difference? And what is best for converting the url to the path.

+22
ios nsfilemanager
Jul 01 2018-11-11T00:
source share
2 answers

The URL includes the protocol used (http: // etc.). The path is not needed or not needed.

+10
Jul 01 2018-11-11T00:
source share

path is the location of the resource (file / directory) in the file system . Just like the iOS file system, another environment file system can be the Windows, Unix, etc. The path may have spaces, such as /docs/random doc/ . (between random and doc)

URL is a link to a resource anywhere (file system, web HTTP, FTP, etc.). A URL cannot have spaces, such as a path.

Web Address: http://stackoverflow.com/
File URL: file://localhost/Users/username/docs/random%20docs/
path for above mentioned file URL : /Users/username/docs/random%20docs/

in the conditions of a layman:

URL = protocol (http, file, etc.) + host (domain name or IP address or local host) + path

+16
May 4 '13 at 17:24
source share



All Articles