我构建Intents扩展,我正在处理INSendMoneyIntent,我说:
应用程序确认后的响应向约翰史密斯发送25欧元
这是你的< Your_App>付款25.00美元。你想发送它吗?
Intent包含正确的货币iso 3代码 - EUR,那么为什么siri在付款确认中显示错误的货币?
返回意图
INSendPaymentIntentResponse *reponse = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeReady userActivity:userActivity];
completion(reponse);
答案 0 :(得分:6)
您需要在
中为您的回复添加paymentRecord(void)confirmSendPayment:(INSendPaymentIntent *)intent
像这样:INSendPaymentIntentResponse *response = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeReady userActivity:userActivity];
response.paymentRecord = [[INPaymentRecord alloc] initWithPayee:intent.payee payer:nil currencyAmount:intent.currencyAmount paymentMethod:nil note:intent.note status:INPaymentStatusPending];
completion(response);
答案 1 :(得分:1)
同意Julius的回答,但它没有显示设置货币的位置。您可以创建方法
- (INPaymentRecord *) getPaymentRecord:(INSendPaymentIntent *)intent
{
INCurrencyAmount *currAmount = [[INCurrencyAmount alloc] initWithAmount: intent.currencyAmount currencyCode:@"ZAR"];
INPaymentMethod *paymentMethod = [[INPaymentMethod alloc] initWithType:INPaymentMethodTypeCredit name:@"" identificationHint:@"" icon:nil];
INPaymentRecord *paymentRecord = [[INPaymentRecord alloc] initWithPayee:nil payer:nil currencyAmount: intent.currencyAmount paymentMethod:paymentMethod note:nil status:INPaymentStatusCompleted ];
return paymentRecord;
}
然后从委托方法中,您只需在上述两个语句之间插入paymentrecord分配:
INSendPaymentIntentResponse *response = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeSuccess userActivity:nil];
**response.paymentRecord = [self getPaymentRecord:intent];**
completion(response);