Use the -[NSURL path]
method:
NSLog(@"%@", myUrl.path);
From the documentation:
The path of the URL, unescaped with the
stringByReplacingPercentEscapesUsingEncoding:
method. If the receiver does not conform to RFC 1808, returnsnil
.If this URL object contains a file URL (as determined with
isFileURL
), the return value of this method is suitable for input into methods of NSFileManager or NSPathUtilities. If the path has a trailing slash it is stripped.Per RFC 3986, the leading slash after the authority (host name and port) portion is treated as part of the path.
Note that you can create such a URL with +[NSURL fileURLWithPath:]
.
Swift 4:
absoluteURL.path
or
yourUrl.path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With