我有Intents.intentdeinition
一个自定义意图的文件定义为OrderIntent
.
当我尝试实例化这个意图并像这样设置它的参数时:
#import "TransactionCart+Intents.h"
#import "OrderItemIntent.h"
@implementation TransactionCart (Intents)
- (nonnull INIntent *)getCartIntent;
{
ItemObject *item = self.itemManager.selectedItem;
OrderItemIntent *intent = [[OrderItemIntent alloc] init];
intent.quantity = item.quantity;
intent.name = item.name;
return intent;
}
@end
我收到一条带有此消息的运行时控制台OrderItemIntent *intent = [[OrderItemIntent alloc]init];
消息:
Unable to initialize 'OrderItemIntent'. Please make sure that your intent definition file is valid.
该应用程序继续运行,但getCartIntent
返回 nil
我已经尝试通过各种更改多次重新创建意图定义文件,但我仍然无法让它工作。