Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 解析INSendPaymentIntent的参数失败_Ios_Swift_Sirikit - Fatal编程技术网

Ios 解析INSendPaymentIntent的参数失败

Ios 解析INSendPaymentIntent的参数失败,ios,swift,sirikit,Ios,Swift,Sirikit,我正在尝试解析INSendPaymentIntent的参数,以便金额永远不应小于零。生成失败,else块中出现错误 '/Users/xx/Documents/Appcelerator_Studio_Workspace/SiriTestApp/extensions/SiriTestApp/siritestapp/IntentHandler.swift:123:79: Cannot convert value of type 'NSDecimalNumber' to expected argumen

我正在尝试解析INSendPaymentIntent的参数,以便金额永远不应小于零。生成失败,else块中出现错误

'/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'.
它需要IncirencyAmount类型的对象。代码中有什么错误

    // 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 ))
            }
        }

}
//需要解析要转账的货币金额时调用。
func resolveCurrencyAmount(对于SendPaymentIntent:INSendPaymentIntent,带完成项:@escaping(IncirenceYaMountResolutionResult)->Void){
//解析货币金额。
如果let currencyAmount=intent.currencyAmount,则let amount=currencyAmount.amount{

如果amount.intValuea正确,则需要将最后一个else块作为incurencyamount类型传递:

completion(INCurrencyAmountResolutionResult.success(with: currencyAmount ))

谢谢。

您的else块应该在
if amount.intValue Hi@dan后面,我已经更正了代码,谢谢。但是仍然有错误(粘贴在上面)