【问题标题】:Get tap event Lock Screen Control(MPRemoteCommandCenter)获取点击事件锁屏控制(MPRemoteCommandCenter)
【发布时间】:2019-02-28 12:19:05
【问题描述】:

我已经实现了用于播放音频的 Avplayer。我已经使用 MPRemoteCommandCenter 来访问锁定屏幕。我可以通过以下方式获得所有访问权限:

    let commandCenter = MPRemoteCommandCenter.shared()

    commandCenter.pauseCommand.addTarget { (event) -> MPRemoteCommandHandlerStatus in
        //Update your button here for the pause command
        return .success
    }

    commandCenter.playCommand.addTarget { (event) -> MPRemoteCommandHandlerStatus in
        //Update your button here for the play command
        return .success
    }

但我想检测用户何时从锁定屏幕点击音乐标题或徽标或播放器。它打开了我们的应用程序。有可能得到吗?

当用户从锁定屏幕点击音乐播放器时,我想打开一个控制器。

【问题讨论】:

  • 我也有同样的问题!

标签: ios swift lockscreen mpremotecommandcenter


【解决方案1】:

您可以在您的应用被激活时做出响应,但由于用户在锁定屏幕中点击了音乐播放器,因此无法得知它已被激活。

【讨论】:

  • 感谢@matt,当音乐播放器处于锁定屏幕时,这意味着我的应用程序处于后台。只是我想知道音乐播放器上的点击事件。
  • 我告诉过你,你无法知道。结束。
  • 你可以在你的应用被激活时响应...你的意思是在 AppDelegate 函数applicationDidBecomeActive ?
  • 这是一种方式,是的
猜你喜欢
  • 1970-01-01
  • 2021-11-14
  • 1970-01-01
  • 2023-03-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多