简体   繁体   中英

NSURl urlWithString replaces body with dots

I try to convert NSString to NSURL however I receive truncated url.

NSURL *url = [NSURL fileURLWithPath:music.url];

If I make NSLog music.url I get:

/Users/Nikita/Library/Developer/CoreSimulator/Devices/D93FE148-7F72-43BB-A545-06D76C71300B/data/Containers/Data/Application/48BC6629-F054-4679-AC7B-709815EC5E2A/Library/Caches/4219609-357670045.mp3

And when NSLog received url:

/Users/Nikita/Library/Developer/CoreSimulator/Devices/D93FE148-7F72-43BB-A545-06D76C71300B/data/Containers/Data/Applicat ... 0045.mp3

The link is partially truncated.

What is the reason? Thank you

music.ulr is obviously an instance of NSString . url is an instance of NSURL . Using NSLog() an instance of a class makes its own decision how to be logged.

Objective-C object, printed as the string returned by descriptionWithLocale: if available, or description otherwise. Also works with CFTypeRef objects, returning the result of the CFCopyDescription function.

NSLog() prints only a description, not the complete object, whatever this should be.

Obviously the developer of NSString thought, that it is a good idea to print out the complete string and wrote a description method doing that. The developer of NSURL thought that it is enough to print the string partially, so you can recognize it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM