Possible Duplicate, Check this answer.
In case the link breaks, it seems you need to enable remote control events with:
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
This should enable the play/pause buttons to send controls to your application. You'll need to set the now playing information manually...
// Swift code, will need converting
var mpic = MPNowPlayingInfoCenter.defaultCenter()
mpic.nowPlayingInfo = [
MPMediaItemPropertyTitle:"This Is a Test",
MPMediaItemPropertyArtist:"Matt Neuburg"
]
You will also need to act on the control events received:
- (void)remoteControlReceivedWithEvent:(UIEvent *)receivedEvent {
if (receivedEvent.type == UIEventTypeRemoteControl) {
switch (receivedEvent.subtype) {
case UIEventSubtypeRemoteControlTogglePlayPause:
[self playOrStop: nil];
break;
case UIEventSubtypeRemoteControlPreviousTrack:
[self previousTrack: nil];
break;
case UIEventSubtypeRemoteControlNextTrack:
[self nextTrack: nil];
break;
default:
break;
}
}
}