捐赠快捷方式时出现问题:无法捐赠与没有有效快捷方式类型的意图的交互

问题描述 投票:0回答:1

如果我在快捷方式应用程序中使用它,我有一个快捷方式,它的作用就像魅力一样,但是, 我正在尝试使用此代码捐赠它

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

我在这里看到了类似的问题:

Siri 意图捐赠快捷方式最终出现错误

但是他们的问题是缺少快捷方式参数的初始化,但是,DoorType 是我唯一的参数并且它已经初始化了,他们还提到intentdefinition 文件应该有快捷方式类型,但在 Xcode 12.5.1 上我不再看到该部分快捷方式类型:

我每次都会收到此错误:

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

我尝试了一切,但我不知道还能做什么。

swift sirikit sirishortcuts
1个回答
0
投票

他们删除了快捷方式类型,而是添加了“建议”,您可以在那里添加参数Custom Intent Suggestions

© www.soinside.com 2019 - 2024. All rights reserved.