原來NSLog();那麼好用

1
2
NSDictionary *playerInfo = [aNotification userInfo];
NSLog(@"%@", playerInfo);

我很好奇這個 NSDictionary 裡面裝了什麼膏藥? 就用NSLog幫忙揭開神祕的面紗 :

Album = “In the Enchanted Garden”;
“Album Rating” = 0;
“Album Rating Computed” = 1;
Artist = “Kevin Kern”;
“Artwork Count” = 1;
Genre = “New Age”;
“Library PersistentID” = “-8755280181446606464”;
Location = “file://localhost/Users/xxxxx/Music/iTunes/iTunes%20Music/Kevin%20Kern/In%20the%20Enchanted%20Garden/07%20Water%20Lilies.mp3”;
Name = “Water Lilies”;
PersistentID = 8747019994823533665;
“Play Count” = 0;
“Play Date” = “2040-02-06 06:28:16 +0800”;
“Player State” = Playing;
“Playlist PersistentID” = “-8755280181446606453”;
“Rating Computed” = 1;
“Skip Count” = 0;
“Skip Date” = “2040-02-06 06:28:16 +0800”;
“Store URL” = “itms://itunes.com/link?n=Water%20Lilies&an=Kevin%20Kern&pn=In%20the%20Enchanted%20Garden”;
“Total Time” = 257802;
“Track Count” = 10;
“Track Number” = 7;
Year = 1996;

另外, 還可以用下列方式

NSString *strOutput = [NSString stringWithFormat:@”%@”, playerInfo];

NSString *strOutput = [playerInfo description];

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.