Apple Pay 中的 Braintree Drop 崩溃

Braintree Drop In Apple Pay crashing

呈现 PKPaymentAuthorizationViewController 总是导致指向我的 AppDelegate 的完全崩溃:线程 1:信号 SIGABRT

let vc = PKPaymentAuthorizationViewController(paymentRequest: paymentRequest) as PKPaymentAuthorizationViewController?

if vc != nil{

    vc!.delegate = self

    self.present(vc!, animated: true, completion: nil)

}else{
    print("error")
}

libc++abi.dylib:以 NSException

类型的未捕获异常终止

顺便说一句:我正在检查 .canMakePayments() 是否首先可用。

异常消息是

Supported orientations has no common orientation with the application, and [PKPaymentAuthorizationViewController shouldAutorotate] is returning YES

PKPaymentAuthorizationViewController 以纵向显示,以便 FaceID 正常工作。

您遇到异常,因为您在项目的 'Device Orientation' 下只选择了景观选项。您需要将肖像添加到此列表。

如果需要,您可以将其余的视图控制器限制为横向。