我将以下代码添加到viewDidLoad中,试图跟踪控制中心中按下next track按钮的时间。不过,它没有记录任何内容。
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[commandCenter.nextTrackCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent *event) {
NSLog(@"next track");
return MPRemoteCommandHandlerStatusSuccess;
}];发布于 2015-05-27 01:24:48
你应该开始播放音频了。您的应用程序必须是“正在播放”应用程序。在开始播放音频之前,应用程序不会接收远程控制事件。https://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Remote-ControlEvents/Remote-ControlEvents.html
我已经在我的应用程序上进行了测试,它使用AVPlayer播放视频,所有的控制中心按钮(next和prev)都能正常工作并发送事件。
https://stackoverflow.com/questions/30464828
复制相似问题