문제

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