[ACCEPTED]-Trying to NSLog an NSNumber ivar in an instance method-nslog
Accepted answer
To insert an object's description in a format 7 string, use %@
.
You can do this with your 6 title/artist/album NSStrings as well so 5 you don't need to call -UTF8String
on them first.
For 4 your song duration, you can either log the 3 NSNumber directly or log a float or integer 2 representation by calling -floatValue
or -integerValue
and logging 1 those with %f
and %d
.
Examples:
NSLog(@"%@", songTitle);
NSLog(@"%@", songDuration);
NSLog(@"%f", [songDuration floatValue]);
NSLog(@"%d", [songDuration integerValue]);
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.