我对这段代码有问题:
MPMediaItem *song = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];
NSString *songTitle = [song valueForProperty:MPMediaItemPropertyTitle];
NSString *songArtist = [song valueForProperty:MPMediaItemPropertyArtist];
//UIImageView *artwork = [[UIImageView alloc] initWithImage:MPMediaItemPropertyArtwork];
self.titleLabel.text = self.songTitle;
self.artistLabel.text = self.songArtist;
它告诉我“找不到财产”?!
但在我的 .h 文件中,我有两个属性:
@property (nonatomic, retain) IBOutlet UILabel *titleLabel;
@property (nonatomic, retain) IBOutlet UILabel *artistLabel;