[ACCEPTED]-Trying to NSLog an NSNumber ivar in an instance method-nslog

Accepted answer
Score: 38

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.


NSLog(@"%@", songTitle);
NSLog(@"%@", songDuration);
NSLog(@"%f", [songDuration floatValue]);
NSLog(@"%d", [songDuration integerValue]);

More Related questions