首页 > 解决方案 > iOS 14 getAllVoiceShortcuts 返回 LaunchServices 错误

问题描述

在一个完全空白的 Xcode 项目中,我只需调用:

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        INVoiceShortcutCenter.shared.getAllVoiceShortcuts { (shortcuts, error) in
        }
    }
}

此日志失败:

[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=271, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}

这将重试 20 次,直到它放弃。

Siri 功能已添加到应用程序中。仅在 iOS 14 GM 和 Xcode 12 GM 中的物理设备上发生。任何帮助将非常感激。

标签: ios14sirishortcuts

解决方案


我有同样的问题(如你所说,仅在物理设备中),但我有 10 次重试,而不是 20 次。在 iOS 14.0 之前我没有错误,所以可能是 SiriKit 中的一些错误。我注意到这只会发生一次 - 当你下次调用它时,没有错误。所以,现在,我在 AppDelegate 中添加了这个调用 - 当应用程序启动时,因为错误会冻结 UI 一秒钟。


推荐阅读