MPRemoteCommandCenter singleton is used for this MPRemoteCommandCenter
For example, you can specify what your application should do when the user clicks play:
MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter]; remoteCommandCenter.playCommand.enabled = YES; //playCommandTarget это переменная, в которой вы сохраняете handler, чтобы можно было его потом убрать self.playCommandTarget = [remoteCommandCenter.playCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent *_Nonnull event) { [self.player play]; // или как у вас там делается play return MPRemoteCommandHandlerStatusSuccess; // тут надо проверить запустилось ли воспроизведение на самом деле и вернуть соответствующий код }];
Remove the handler when not needed.
MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter]; [remoteCommandCenter.playCommand removeTarget:self.playCommandTarget];
MPRemoteCommandCenter- Max Mikheyenko