سؤال

In my testing, it seems that playing MPMediaItem through MPMusicPlayerController does not update the Play Count (using iPod or application instance)

Can anyone confirm this? I haven't seen anything in the documentation either.

هل كانت مفيدة؟

المحلول

In my tests, the play count gets updated for both iPodMusicPlayer and applicationMusicPlayer.

First I skipped through to the end of the song. Then I jumped back to the previous track and tested the play count using valueForProperty after getting a MPMusicPlayerControllerNowPlayingItemDidChangeNotification:

- (void)handleNowPlayingItemChange:(NSNotification *)itemNotification {
     MPMediaItem *currentMediaItem = [[self musicPlayer] nowPlayingItem];
     NSNumber *currentPlayCount = [currentMediaItem valueForProperty:MPMediaItemPropertyPlayCount];
     NSLog(@"Current play count: %@", currentPlayCount);
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top