2015-07-08 2 views
6

Я работаю над музыкальным приложением, а в предыдущих версиях iOS медиаплеер показывал воспроизведение/паузу, а также кнопки пропуска и превью. Теперь, с обновлением 8.4, все, что отображается, это воспроизведение/пауза. Я обновление MPNowPlayingInfoCenter обычным способом:iOS 8.4 MPNowPlayingInfoCenter skip/prev исчез

NSDictionary* nowPlayingInfo = @{ 
    MPMediaItemPropertyTitle:[self.currentSong title], 
    MPMediaItemPropertyArtist:[self.currentSong artist], 
    MPMediaItemPropertyPlaybackDuration:[NSNumber numberWithDouble:(double) self.duration], 
    MPNowPlayingInfoPropertyElapsedPlaybackTime: [NSNumber numberWithDouble:(double)self.currentPlaybackTime], 
    MPNowPlayingInfoPropertyPlaybackRate: self.isPlaying ? @1.0 : @0.0, 
    MPMediaItemPropertyArtwork: mediaPlayerArtwork, 
    MPNowPlayingInfoPropertyPlaybackQueueIndex: [NSNumber numberWithInteger:playQueue.queuePosition], 
    MPNowPlayingInfoPropertyPlaybackQueueCount: [NSNumber numberWithInteger:playQueue.queueIDs.count] }; 
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:nowPlayingInfo]; 

Но результат ... enter image description here

и enter image description here

Спасибо за любую помощь!

ответ

5

Для того, чтобы получить следующую и предыдущую кнопки назад вам нужно добавить:

[[MPRemoteCommandCenter sharedCommandCenter].nextTrackCommand addTarget:self action:@selector(remoteNextPrevTrackCommandReceived:)]; 
[[MPRemoteCommandCenter sharedCommandCenter].previousTrackCommand addTarget:self action:@selector(remoteNextPrevTrackCommandReceived:)]; 

Я добавил это в

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

Если вы уже получающие удаленные события действия AppDelegate в метод может быть пустым:

-(void) remoteNextPrevTrackCommandReceived:(id)event {}

Смежные вопросы