为什么播放音乐时控制按钮在锁定屏幕和命令中心禁用?

时间:2016-11-24 10:08:08

标签: ios objective-c audio remote-control remotecommand

为什么播放音乐时控制按钮在锁定屏幕和命令中心禁用?我使用MPRemoteCommandCenter来控制通过远程访问。请帮助我,非常好。

顺便说一下

  1. 应用程序没有被杀死。
  2. 我添加了admob SDK作为我的应用程序非页内广告。
  3. 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:)];
    }
    

0 个答案:

没有答案