【发布时间】:2019-05-08 13:17:12
【问题描述】:
显示 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() 是否可用。
异常消息是
支持的方向与应用程序没有共同的方向,并且 [PKPaymentAuthorizationViewController shouldAutorotate] 返回 YES
【问题讨论】:
-
与异常相关的消息是什么?
-
@Paulw11 我试图用断点( po $arg1 )捕获异常并得到:支持的方向与应用程序没有共同的方向,并且 [PKPaymentAuthorizationViewController shouldAutorotate] 返回 YES objc [63935]: pthread_rwlock_rdlock 失败 (11)
-
对,所以您已将应用锁定为横向模式,但 Apple Pay 必须以纵向模式呈现。确保您的应用允许纵向显示。
-
@Paulw11 谢谢。是的。我真的希望 Apple Pay 也能在横向模式下工作。但至少我学到了一些关于调试的新知识( po $arg1 )。我真的不想为我的应用程序支持纵向模式。我需要找到解决方法。