Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
294 views
in Technique[技术] by (71.8m points)

nsfilemanager - What's the difference between path and URL in iOS?

In a class such as NSFileManager there are 2 versions of practically every method. One for paths and one for URLs. What's the difference? And what's the best practice for converting a URL to a path.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

path is location of a resource (file/directory) in a file system. Just like iOS File System, other environments file system can be Windows file system, Unix etc. Path can have spaces like /docs/random doc/. (between random and doc)

URL is is a reference to a resource anywhere (file system, web HTTP, FTP etc). URL can not have spaces like path.

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

in layman terms:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...