ios - nextTrackCommand 和 seekForwardCommand 都同时被调用
问题描述
似乎当我在播放某些东西(模拟器或设备)时按控制中心上的“下一步”时,两者nextTrackCommand
都seekForwardCommand
被调用。
这两个功能都已启用,但只需点击“下一步”按钮即可调用这两个功能是没有意义的。
这是更多代码:
[MPRemoteCommandCenter sharedCommandCenter].playCommand.enabled = YES;
[[MPRemoteCommandCenter sharedCommandCenter].playCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
return MPRemoteCommandHandlerStatusSuccess;
}];
[[MPRemoteCommandCenter sharedCommandCenter].nextTrackCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
NSLog(@"nextTrackCommand");
return MPRemoteCommandHandlerStatusSuccess;
}];
[MPRemoteCommandCenter sharedCommandCenter].nextTrackCommand.enabled = YES;
[[MPRemoteCommandCenter sharedCommandCenter].seekForwardCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
NSLog(@"seekForwardCommand");
return MPRemoteCommandHandlerStatusSuccess;
}];
[MPRemoteCommandCenter sharedCommandCenter].seekForwardCommand.enabled = YES;
我已将下面链接到演示此问题的示例项目。
解决方案
推荐阅读
- gradle - Gradle:如何从工件创建分布并重命名工件
- python - 检查 VCF 中的 ALT 字段是尖括号标记还是使用 pyvcf 的尖括号标记列表
- spring - 在 PreHandle 函数中仅处理控制器路由
- angular - 如何使用 rxjs 以角度过滤对象数组
- spring - Tomcat HTTP 状态 404 – 未找到
- matlab - 由 * 完成的矩阵乘法和手工通过组件完成的矩阵乘法之间的差异问题(MATLAB)
- python - 网页抓取时访问被拒绝 403;该怎么办?
- powershell - 如何在 Windows 10 中保存 PowerShell 的状态以便以后继续使用?
- javascript - 递归解码 URL 给出有效 URL 的错误
- android - 如何在场景黑暗时自动打开手电筒进行视频录制?