iOS 8.4 MPNowPlayingInfoCenter skip/prev disappeared
Asked Answered
I

1

6

I'm working on a music playing app and in previous iOS versions the media player would show the play/pause as well as the skip and prev buttons. Now, with the 8.4 update, all that is shown is the play/pause. I'm updating the MPNowPlayingInfoCenter in the usual way:

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];

But the result is... enter image description here

and enter image description here

Thanks for any help!

Incision answered 8/7, 2015 at 21:4 Comment(0)
I
5

In order to get the next and prev buttons back you need to add:

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

I added this in AppDelegate's

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

If you're already receiving remote events the action method can be empty:

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

Incision answered 10/7, 2015 at 0:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.