我希望开发人员像这样执行快捷方式操作,而房间名称是我在我的应用中编辑的,请在 此处输入图片描述
所以我这样定义意图文件
我的捐赠代码是这样的
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。请帮助!
我已经弄清楚了,只需将你的参数更改为小写字母,然后它就可以了
您好,欢迎来到!请阅读导览,以及如何写一个好的答案?尝试详细说明应注意的事项。