Problem when donating shortcuts: Cannot donate interaction with intent that has no valid shortcut types

Viewed 460

I have a shortcut that works like a charm if I use it in the shortcuts app, however, I am trying to donate it using this code

func donateInteraction(result: @escaping FlutterResult) {
        let intent = OpenDoorIntent()
        intent.DoorType = DoorType.flat;
        intent.suggestedInvocationPhrase = "Open my flat";
       
       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")
             result("Shortcut Donated");
           }
         }
       }
     }

I saw a similar question here:

Siri Intent Donation for Shortcuts ending up with error

but their problem was that the initialization of shortcut parameters was missing, however, DoorType is my only parameter and it is already initialized, they Also mention that the intentdefinition file should have shortcut types but on Xcode 12.5.1 I no longer see the section of shortcut types:

Xcode 12.5.1 intentdefinition file

intentdefinition file 2

I get this error every time:

2021-07-23 20:35:08.227514+0200 Runner[6823:556804] flutter: Donation result is Shortcut Donation error .
2021-07-23 20:35:08.226190+0200 Runner[6823:557342] [Intents] -[INInteraction donateInteractionWithCompletion:]_block_invoke Cannot donate interaction with OpenDoorIntent that has no valid shortcut types
Interaction donation failed: %@
Error Domain=IntentsErrorDomain Code=1901 "Cannot donate interaction with intent that has no valid shortcut types: <INInteraction: 0x281a80000> {
    intent = <INIntent: 0x2810e5180> {
    };
    dateInterval = <_NSConcreteDateInterval: 0x283ebc540> (Start Date) 2021-07-23 18:35:08 +0000 + (Duration) 0.000000 seconds = (End Date) 2021-07-23 18:35:08 +0000;
    intentResponse = <null>;
    groupIdentifier = <null>;
    intentHandlingStatus = Unspecified;
    identifier = E39F49C5-222D-422A-9BEB-7F5AFBF9CB12;
    direction = Unspecified;
} for intent <OpenDoorIntent: 0x281098c80> {
    doorType = 1;
}" UserInfo={NSLocalizedDescription=Cannot donate interaction with intent that has no valid shortcut types: <INInteraction: 0x281a80000> {
    intent = <INIntent: 0x2810e5180> {
    };
    dateInterval = <_NSConcreteDateInterval: 0x283ebc540> (Start Date) 2021-07-23 18:35:08 +0000 + (Duration) 0.000000 seconds = (End Date) 2021-07-23 18:35:08 +0000;
    intentResponse = <null>;
    groupIdentifier = <null>;
    intentHandlingStatus = Unspecified;
    identifier = E39F49C5-222D-422A-9BEB-7F5AFBF9CB12;
    direction = Unspecified;
} for intent <OpenDoorIntent: 0x281098c80> {
    doorType = 1;
}}

I tried everything and I have no idea what else to do.

0 Answers
Related