gpt4 book ai didi

尝试 Apple Pay 时,iOS 模拟器卡在 "Pay with Passcode"

转载 作者:行者123 更新时间:2023-11-28 13:07:24 27 4
gpt4 key购买 nike

我正在尝试在我的应用程序上设置 Apple Pay,但我目前没有 iPhone 6。因此,在我去购买模拟器或尝试找人借给我之前,我会尝试使用模拟器启动并运行所有功能。

无论如何,我到了实际展示 ApplePay View Controller 的地步:

enter image description here

但是当我点击“使用密码支付”时没有任何反应,所以我无法继续使用服务器完成所有测试。

以下是我的代码的相关部分:

class PaymentVC: UIViewController,PKPaymentAuthorizationViewControllerDelegate {

@IBAction func onPaymentSubmit(sender: AnyObject) {
if PKPaymentAuthorizationViewController.canMakePaymentsUsingNetworks(supportedPaymentNetworks) {
let applePayMerchantID = "merchant.com.id"

let request = PKPaymentRequest()
request.merchantIdentifier = applePayMerchantID
request.supportedNetworks = supportedPaymentNetworks
request.merchantCapabilities = PKMerchantCapability.Capability3DS
request.countryCode = "US"
request.currencyCode = "USD"
request.paymentSummaryItems = [
PKPaymentSummaryItem(label: "Custom Order", amount: NSDecimalNumber(float: total))
]
let applePayController = PKPaymentAuthorizationViewController(paymentRequest: request)
applePayController.delegate = self
self.presentViewController(applePayController, animated: true, completion: nil)
}
}

//MARK: Apple Pay

func paymentAuthorizationViewController(controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: (PKPaymentAuthorizationStatus) -> Void) {

}

func paymentAuthorizationViewControllerDidFinish(controller: PKPaymentAuthorizationViewController) {
controller.dismissViewControllerAnimated(true, completion: nil)
}

}

知道哪里出了问题吗?

最佳答案

您需要在 paymentAuthorizationViewController 中返回付款状态。您会看到委托(delegate)方法有一个完成处理程序,您必须调用它来指示您是否能够成功处理付款。

关于尝试 Apple Pay 时,iOS 模拟器卡在 "Pay with Passcode",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32321423/

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