iOS: 如何定义无输入操作快捷方式的意图文件

iOS: How to define the intent file for no input action shortcuts

我希望开发人员像这样的快捷方式操作,房间名称是我在我的应用程序中编辑的 enter image description here

所以我这样定义意图文件

enter image description here

我的捐赠代码是这样的

    LightControlIntent *intent = [[LightControlIntent alloc] init];
    [intent setROOMNAME:@"MY BIG BIG HOUSE"];
    
    INInteraction *recation = [[INInteraction alloc] initWithIntent:intent response:nil];
    [recation donateInteractionWithCompletion:^(NSError * _Nullable error) {
        if(!error) {
            NSLog(@"donation success");
        }else {
            NSLog(@"donation fail %@",error.localizedDescription);
        }
    }];

但它不起作用,这是 Xcode 打印,

donation fail Cannot donate interaction with intent that has no valid shortcut types: <INInteraction: 0x6000013bc9c0> {
    intent = <INIntent: 0x6000019b3f00> {
    };
    dateInterval = <_NSConcreteDateInterval: 0x6000037ede60> (Start Date) 2020-12-10 06:49:53 +0000 + (Duration) 0.000000 seconds = (End Date) 2020-12-10 06:49:53 +0000;
    intentResponse = <null>;
    groupIdentifier = <null>;
    intentHandlingStatus = Unspecified;
    identifier = 4FEC8BA0-6E7E-4605-8246-7B06833A7863;
    direction = Unspecified;
} for intent <LightControlIntent: 0x6000019a2880> {
    rOOMNAME = MY BIG BIG HOUSE;
}

我尝试在建议部分定义“无参数”,然后我可以捐赠成功,但它无法获得ROOMNAME.please帮助!

我已经弄明白了,只需将您的参数更改为小写,然后就可以了