Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Pay crash with on PKPaymentAuthorizationControllerExportedObject authorizationDidFinishWithError

When I use Apple Pay with Stripe's iOS SDK, it crashes on following method after payment?

-[PKPaymentAuthorizationControllerExportedObject authorizationDidFinishWithError:] + 76

What am I doing wrong?

like image 814
vintagexav Avatar asked Apr 25 '15 17:04

vintagexav


Video Answer


1 Answers

I had the same crash. Apple pay would work the first time but on the second try we would get the crash and could reproduce it every time. The problem is that in the delegate method didAuthorizePayment I was doing all the backend processing and when that was successful I was calling the completion block with completion(PKPaymentAuthorizationStatus.Success) and then dismissing the view controller.

Instead I moved the dismiss code from the didAuthorizePayment method to the 'didFinish' method (which required me to hold onto some state to pass to the receipt page). Once I did that the done button was shown on the apple pay controller and the crashes went away.

like image 120
Brandon Avatar answered Oct 27 '22 04:10

Brandon