如果快捷方式应用已删除,则INUIAddVoiceShortcutButton不起作用

问题描述

我添加了一个INUIAddVoiceShortcutButton,它可以正常工作,但是当我删除快捷方式应用程序时,它将停止工作。代表仍然返回快捷方式成功,但是按钮没有更改以反映添加了快捷方式。我发现必须重新安装“快捷方式”应用程序并重新启动手机才能返回功能。

是否可以确定是否已安装Ahortcuts应用程序?缺少什么吗?

我还使用Apple的演示Soup Chef应用程序对此进行了测试。

解决方法

我发现最好的方法是致电INVoiceShortcutCenter.shared.getAllVoiceShortcuts返回错误:

Optional(
    Error Domain=IntentsErrorDomain
    Code=7001 "Failed to get voice shortcuts"
    UserInfo={
        NSDebugDescription=Failed to get voice shortcuts,NSUnderlyingError=0x283c42910
        {
            Error Domain=VCVoiceShortcutsErrorDomain
            Code=1004
            "Shortcuts app is not installed"
            UserInfo={NSLocalizedFailureReason=Shortcuts app is not installed
        }
    }}
)

添加快捷方式后,它返回nil:

func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController,didFinishWith voiceShortcut: INVoiceShortcut?,error: Error?) {
    INVoiceShortcutCenter.shared.getVoiceShortcut(with: voiceShortcut!.identifier) { (shortcut,error) in
        print("\(String(describing: shortcut))") // nil
        print("\(error.debugDescription)") // nil
    }
}

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...