【发布时间】:2016-07-06 01:36:11
【问题描述】:
MPRemoteCommandCenter 多次调用处理程序块并导致对选择器方法的不必要调用。
这里是代码sn-p:
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[commandCenter.nextTrackCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
NSLog(@"NEXTTTTTT");
return MPRemoteCommandHandlerStatusSuccess;
}];
[commandCenter.previousTrackCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
NSLog(@"PREVIOUSSS");
return MPRemoteCommandHandlerStatusSuccess;
}];
当用户在屏幕锁定时点击音乐播放器底座上的下一个或上一个按钮时,会导致多次调用上述块。
【问题讨论】:
标签: ios iphone ios9 audio-player mpmusicplayercontroller