在我的应用程序中,我实现了 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)
}