【发布时间】:2018-11-16 16:16:08
【问题描述】:
在我的应用中,我实现了 Siri 快捷方式。用户可以使用INUIAddVoiceShortcutButton 添加快捷方式,这会显示INUIAddVoiceShortcutViewController。这非常有效。用户可以使用INUIAddVoiceShortcutButton 添加和编辑快捷方式。但是我如何以编程方式删除快捷方式?当用户删除应该使用此快捷方式执行的操作时,应该会发生这种情况。
这是我显示INUIAddVoiceShortcutViewController的代码:
let videoReturnIntent = VideoShortcutIntent()
videoReturnIntent.videoID = informationToShowDetail.videoID!
videoReturnIntent.suggestedInvocationPhrase = "Test"
videoShortCutIntent = videoReturnIntent
if let shortcut = INShortcut(intent: videoReturnIntent) {
let viewController = INUIAddVoiceShortcutViewController(shortcut: shortcut)
viewController.modalPresentationStyle = .formSheet
viewController.delegate = self // Object conforming to `INUIAddVoiceShortcutViewControllerDelegate`.
present(viewController, animated: true, completion: nil)
}
【问题讨论】:
-
只是说,我不希望应用程序能够删除我创建的快捷方式。最多建议我这样做,并将我链接到“设置”应用。
标签: swift siri sirishortcuts