I try to get NSString
from NSURL
with this method:
NSString *tmp2 = [item.path absoluteString];
Unfortunately I get instead of the NSURL:
<CFURL 0x173c50 [0x3f1359f8]>{type = 0, string = /var/mobile/Applications/A30FD2E4-A273-4522-AFD5-A981EFD3C2AA/Documents/*** *** - *** ***.***, encoding = 134217984, base = (null)}
I get :
file://localhost/var/mobile/Applications/A30FD2E4-A273-4522-AFD5-A981EFD3C2AA/Documents/***%20***%20-%20***%20***.***
any idea why?
The NSURL documentation clearly states that absoluteString
returns an NSString, just like your code above. This is the string representation of the absolute path, so what you are getting is what you should be getting.
However, looking at the documentation you could also use path
, relativePath
or relativeString
to get a string representation of the url in other formats (absolute or relative paths that either do or do not conform to RFC 1808 (a now obsolete percent encoding).
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