The INUIAddVoiceShortcutViewController won't dismiss

Hi !


I implement Intent in my Ap. But I wanted to set Siri Shortcut in the app. So I used the code given here :

https://developer.apple.com/documentation/sirikit/inuiaddvoiceshortcutviewcontroller


But when the ViewController appear The button cancel doesn't work neither the ok button when I record my phrase.


And I got this error :


2018-10-12 10:16:51.985156+0200 AppName[1029:172350] [default] No results found for query: {(
<_LSApplicationIsInstalledQuery: 0x28226e560>
)}
2018-10-12 10:16:51.989467+0200 AppName[1029:172263] [strings] ERROR: Add to Siri not found in 
table Localizable of bundle CFBundle 0x111a01d00 </var/containers/Bundle/Application/DDADF244-FBCE-47C0-90F8-E8C8ADA6962E/AppName.app> (executable, loaded)


Do I miss some step ?

Thanks

Replies

You've to implement "INUIAddVoiceShortcutViewControllerDelegate" to the presenting controller and then add the following methods:

func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) {
  controller.dismiss(animated: true, completion: nil)
}
 
func addVoiceShortcutViewControllerDidCancel(_ controller: INUIAddVoiceShortcutViewController) {
  controller.dismiss(animated: true, completion: nil)
}


To dismiss the "INUIAddVoiceShortcutViewControllerDelegate" you've to call "controller.dismiss(animated: true, completion: nil)" in those methods.

When you present the "INUIAddVoiceShortcutViewControllerDelegate" you've to set as delegate the presenting controller:


let viewController = INUIAddVoiceShortcutViewController(shortcut: inShortcut)
viewController.modalPresentationStyle = .pageSheet
viewController.delegate = self
self.present(viewController, animated: true, completion: nil)