I have created a simple intent for Siri shortcut and whenever i am trying to donate the intent, it is ending up with following error.
Interaction donation failed: %@ Error Domain=IntentsErrorDomain Code=1901 "Cannot donate interaction { intent = { user = ; identifier = 06DE1A38-6D46-4CB8-B825-3788E6A81420; }; dateInterval = <_NSConcreteDateInterval: 0x60000043cce0> (Start Date) 2018-07-17 12:38:39 +0000 + (Duration) 0.000000 seconds = (End Date) 2018-07-17 12:38:39 +0000; intentResponse = ; groupIdentifier = ; intentHandlingStatus = Unspecified; identifier = F145FA84-7147-41A8-8698-681F06C8CEB5; direction = Unspecified; } with intent that has no valid shortcut types" UserInfo={NSLocalizedDescription=Cannot donate interaction { intent = { user = ; identifier = 06DE1A38-6D46-4CB8-B825-3788E6A81420; }; dateInterval = <_NSConcreteDateInterval: 0x60000043cce0> (Start Date) 2018-07-17 12:38:39 +0000 + (Duration) 0.000000 seconds = (End Date) 2018-07-17 12:38:39 +0000; intentResponse = ; groupIdentifier = ; intentHandlingStatus = Unspecified; identifier = F145FA84-7147-41A8-8698-681F06C8CEB5; direction = Unspecified; } with intent that has no valid shortcut types}
The following is my intent donation code
func donateInteraction() {
let intent = GetBalanceIntent()
intent.suggestedInvocationPhrase = "Get Balance"
let interaction = INInteraction(intent: intent, response: nil)
interaction.donate { (error) in
if error != nil {
if let error = error as NSError? {
print("Interaction donation failed: %@", error)
} else {
print("Successfully donated interaction")
}
}
}
}
I missed initializing the custom property(i.e user in the above example) which i have defined in the definition file.
Adding it solved the problem. Code looks like this:
func donateInteraction() {
let intent = GetBalanceIntent()
intent.suggestedInvocationPhrase = "Get Balance"
intent.user = "vittal"
let interaction = INInteraction(intent: intent, response: nil)
interaction.donate { (error) in
if error != nil {
if let error = error as NSError? {
print("Interaction donation failed: %@", error)
} else {
print("Successfully donated interaction")
}
}
}
}
I had the same problem, I realized that my INIntent subclass name on my swift file wasn't matching the one in the . intentdefinition, hope this helps someone.
Your intent definition file should have valid shortcut types. You can add those under shortcut types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With