iosandroid-intentshortcutsirikit

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


I want developer a shortcuts action just like this and roomname is i edit in my app enter image description here

so i define the intents file like this

enter image description here

and my donation code is like this

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

but it doesn't work ,this is the Xcode print,

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

i try to define the "no parameters" in suggestions section,then i can donation success,but it can't get ROOMNAME.please Help!


Solution

  • i have figure this out, just change your parameter to lowcase ,then it works