EXC_BAD_ACCESS when submiting a Apple Pay payload to process

I'm working in a app that uses Apple Pay, and everything was working, but suddenly this crash start to happen

func startPaymentWith(output: PaymentHandlerResponseProtocol?) { self.output = output self.output?.startProcess() // Create our payment request let paymentRequest = PKPaymentRequest() paymentRequest.paymentSummaryItems = paymentSummaryItems paymentRequest.merchantIdentifier = "merchant.br.com.tim.appmeutim2" paymentRequest.merchantCapabilities = .capability3DS paymentRequest.countryCode = "BR" paymentRequest.currencyCode = "BRL" paymentRequest.supportedNetworks = self.supportedNetworks

print("comoestaovalorsemreplace \(paymentRequest.paymentSummaryItems[0].amount)")
// Display our payment request
paymentController = PKPaymentAuthorizationController(paymentRequest: paymentRequest) // Here happens the EXC_BAD_ACCESS
paymentController?.delegate = self
paymentController?.present(completion: { (presented: Bool) in
    if presented {
        debugPrint("Presented payment controller")
    } else {
        debugPrint("Failed to present payment controller")
        self.output?.responseWith(nil)
    }
})

}

This is showed in var paymentRequest when is hover the mouse pointer above the variable:

expression produced error: error: /var/folders/sp/8x6rp88s4nv6s3z1635pqdtm0000gq/T/expr139-c248cd..swift:1:65: error: cannot find type 'PassKit' in scope Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<PassKit.PKPaymentRequest>(bitPattern: 0x15e4e9da0)!.pointee)

Answered by Systems Engineer in 693459022

Okay, if you have the full Apple crash report and are able to post it here, I will take a look. Otherwise, one thing you can do is compare your implementation against the native Apple Pay implementation for Offering Apple Pay in Your App. The two implementations for PKPaymentRequest look very close except for shipping information.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Accepted Answer

Okay, if you have the full Apple crash report and are able to post it here, I will take a look. Otherwise, one thing you can do is compare your implementation against the native Apple Pay implementation for Offering Apple Pay in Your App. The two implementations for PKPaymentRequest look very close except for shipping information.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
EXC_BAD_ACCESS when submiting a Apple Pay payload to process
 
 
Q