Braintree Drop In Apple Pay crashing

2019-03-03 14:06发布

问题:

Presenting PKPaymentAuthorizationViewController always results in a total crash with pointing to my AppDelegate: Thread 1: signal 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: terminating with uncaught exception of type NSException

btw.: I am checking .canMakePayments() if it is available first.

The exception message is

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

回答1:

The PKPaymentAuthorizationViewController is presented in portrait orientation so that FaceID functions correctly.

You are getting an exception as you have only landscape options selected under 'Device Orientation' in your project. You need to add portrait to this list.

You can limit the rest of your view controllers to landscape orientation if that is what you want.