2

Why dos the control button disable on lock screen and command center when playing Music? I use MPRemoteCommandCenter to control the access via remote. Please help me,tx very much.

Btw

  1. The app was not killed.
  2. I add admob SDK as my app Interstitial AD.

control button disable on command center

control button disable on lock screen

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.1) {
    MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
    commandCenter.playCommand.enabled = YES;
    [commandCenter.playCommand addTarget:self action:@selector(playAction:)];

    [commandCenter.pauseCommand addTarget:self action:@selector(pauseAction:)];

    commandCenter.previousTrackCommand.enabled = YES;
    [commandCenter.previousTrackCommand addTarget:self action:@selector(previousTrackAction:)];

    commandCenter.nextTrackCommand.enabled = YES;
    [commandCenter.nextTrackCommand addTarget:self action:@selector(nextTrackAction:)];

    commandCenter.togglePlayPauseCommand.enabled = YES;
    [commandCenter.togglePlayPauseCommand addTarget:self action:@selector(playOrPauseAction:)];
}
AMAN77
  • 6,218
  • 9
  • 45
  • 60
Leo
  • 21
  • 2

0 Answers0