AVHapticPlayer 异步调用 finishWithCompletionHandler: (type=3) 30 秒后没有得到回复

AVHapticPlayer async call finishWithCompletionHandler: (type=3) did not get a reply after 30 seconds

问题

我在我的应用程序中使用 触觉反馈 来处理用户移动某些图块时的情况。当瓷砖移动得非常快,导致触觉反馈快速触发时,我在 30 秒后在控制台中收到此警告:

2019-01-20 17:29:04.658240+0000 Loopover[17824:4937487] [Feedback] AVHapticPlayer async call finishWithCompletionHandler: (type=3) did not get a reply after 30 seconds (notified of 0 mediaserverd death(s) in this time)

触觉反馈是如何触发的?

我正在使用 UIImpactFeedbackGenerator 触发触觉反馈,如图所示:

UIImpactFeedbackGenerator(style: .light).impactOccurred()

这是什么意思?

我应该担心这个警告吗?如果我正常移动瓷砖,不会出现问题。

如果有的话我该怎么办?

Is this warning something I should be worried about? What should I do, if anything?

我猜没有,而且 none。在 Apple 关于 UIFeedbackGenerator https://developer.apple.com/documentation/uikit/uifeedbackgenerator 的文档中,他们说你应该 "Trust the system" 关于那个。

谈论方法 impactOccurred():

Note that calling these methods does not play haptics directly. Instead, it informs the system of the event. The system then determines whether to play the haptics based on the device, the application’s state, the amount of battery power remaining, and other factors.

目前仅播放触觉反馈:

  • 在支持 Taptic Engine 的设备上

  • 当应用 运行 在前台时

  • 启用系统触觉设置时

关于 "Trust the system":

As a general rule, trust the system to determine whether it should play feedback. Don't check the device type or app state to conditionally trigger feedback. After you’ve decided how you want to use feedback, always trigger it when the appropriate events occur. The system ignores any requests that it cannot fulfill.

希望对您有所帮助!