为什么播放音乐时锁定屏幕和命令中心的控制按钮禁用?我使用 MPRemoteCommandCenter 通过远程控制访问。请帮助我,非常感谢。
顺便提一句
- 该应用程序没有被杀死。
- 我将 admob SDK 添加为我的应用插页式广告。
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:)];
}