【问题标题】:SiriKit payment confirmation currency is always US$SiriKit 付款确认货币始终为美元
【发布时间】:2016-12-31 12:33:38
【问题描述】:

我构建了 Intents Extension,我正在处理 INSendMoneyIntent,我是说:

给约翰·史密斯 25 欧元

应用确认后回复

这是您的 付款 25.00 美元。要发送吗?

Intent 包含正确的货币 iso 3 代码 - EUR,那么为什么 siri 在付款确认中显示错误的货币?

返回意图

INSendPaymentIntentResponse *reponse = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeReady userActivity:userActivity];
completion(reponse);

【问题讨论】:

  • 请出示一些代码?
  • 添加了,但是严重的是,这不可能是代码错误,而是配置问题?
  • iOS 10 仍处于测试阶段,您最好直接使用reporting this as a bug to Apple。并且可能会在他们的测试版论坛上发帖。
  • 另外,欢迎使用 Stack Overflow。 (我可以建议设置一个真实的用户名吗?其他用户可能更愿意回答。这是一件小事,但有很大的不同。)
  • 问题解决了吗? @user3292998

标签: ios ios10 sirikit intents-extension


【解决方案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);

【讨论】:

  • 可能你错了,intent的实例是从confirmSendPayment传递过来的,所以基本上你需要做的就是在confirmSendPayment中设置货币
【解决方案2】:

您需要在回复中添加一个 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);

【讨论】:

    猜你喜欢
    • 2019-10-04
    • 1970-01-01
    • 2015-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    • 2023-03-13
    相关资源
    最近更新 更多