0

I had added a INUIAddVoiceShortcutButton which works fine, but when I delete the Shortcuts App it stops working. The delegates still return that the shortcut was successful, but the button doesn't change to reflect that the shortcut was added. I found that I have to re-install the Shortcuts app AND restart my phone to return function.

Is there a way to determine if the Ahortcuts app is install? Is there something missing?

I also tested this with Apple's demo Soup Chef app.

Michael Ozeryansky
  • 7,204
  • 4
  • 49
  • 61
  • 1
    Perhaps you could check if you `canOpen` the shortcuts URL scheme? https://support.apple.com/en-au/guide/shortcuts/apd624386f42/ios – Paulw11 Oct 13 '20 at 21:37
  • @Paulw11 I'll try that, but seems like an Apple bug since it successful says the shortcut was added, but it just doesn't work. Adding it again doesn't show the edit view and says a shortcut with the same name already exists. – Michael Ozeryansky Oct 13 '20 at 21:54

1 Answers1

0

The best I've found is calling INVoiceShortcutCenter.shared.getAllVoiceShortcuts returns an error:

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
        }
    }}
)

And after adding the shortcut it returns 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
    }
}
Michael Ozeryansky
  • 7,204
  • 4
  • 49
  • 61