gpt4 book ai didi

ios - 解析 INSendPaymentIntent 的参数失败

转载 作者:行者123 更新时间:2023-11-30 12:39:27 25 4
gpt4 key购买 nike

我正在尝试解析 INSendPaymentIntent 的参数,以使金额永远不小于零。构建失败,else block 中出现错误,显示

'/Users/xx/Documents/Appcelerator_Studio_Workspace/SiriTestApp/extensions/SiriTestApp/siritestapp/IntentHandler.swift:123:79: Cannot convert value of type 'NSDecimalNumber' to expected argument type 'INCurrencyAmount'.

它需要一个 INCurrencyAmount 类型对象。代码有什么问题?

    // Called when you need to resolve the currency amount to be transferred.
func resolveCurrencyAmount(forSendPayment intent: INSendPaymentIntent, with completion: @escaping (INCurrencyAmountResolutionResult) -> Void) {

// Resolve the currency amount.
if let currencyAmount = intent.currencyAmount, let amount = currencyAmount.amount{
if amount.intValue <= 0 {
// The amount needs to be a positive value.
completion(INCurrencyAmountResolutionResult.unsupported())
}else{
completion(INCurrencyAmountResolutionResult.success(with: amount ))
}
}

}

最佳答案

好吧,最后一个 else block 需要作为 INCurrencyAmount 类型传递:

completion(INCurrencyAmountResolutionResult.success(with: currencyAmount ))

谢谢。

关于ios - 解析 INSendPaymentIntent 的参数失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42416463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com