Problem summary: After a successful verification of the Paypal credentials, the Paypal UI returns to a screen with a spinning button. When this button is pressed, the calling app crashes. (The details about the sequence of events is explained below.)
Constellations about the error occurrence:
The error appears in tests on a physical device. It does not occur in tests with various simulators in Xcode.
Then the error appears only in the context of a first initial payment with Paypal. It does not appear in succeeding payments.
Information about how my app is using the Paypal SDK:
import PayPalCheckout
Version: PayPalCheckout (0.109.0)
Sections in swift code:
Checkout.setCreateOrderCallback { action in
let amount = PurchaseUnit.Amount(currencyCode: .eur, value: identifiersDict[Identifiers.chargeValue.rawValue]?.input ?? "")
let purchaseUnit = PurchaseUnit(amount: amount)
let order = OrderRequest(intent: .capture, purchaseUnits: [purchaseUnit]
action.set(orderId: answerFromPaymentPaypalBackend.id)
}
Checkout.setOnApproveCallback { approval in
approval.actions.authorize { response, error in
...
Checkout.setOnCancelCallback {
...
Checkout.start(presentingViewController: self)
presentingViewController is a function of the PPCheckout SDK already.
Information about the crash found in Crashlytics:
PayPalCheckout__swift_memcpy168_8() and PayPalCheckoutblock_destroy_helper()
The sequence of events in detail:
(I give the appearing paypal screens numbers for better reference in the adjacent comments)
presentingViewController will make the following screens to appear:
Screen 1 // Entering Email address:
Screen 2 // Approval:
Screen 3 // Password input:
Screen 4 / 2FA dialogue:
Screen 5 // reappearance of screen 1:
Screen 6 // Amount confirmation
Everything from Screen 6 onwards works fine.
Now: Relevant for the error is the appearance of screen 5. In an error-free case, this screen appears only for a fraction of a second and then continues to screen 6. But in the error case, screen 5 does not disappear. The text in the button of that screen, which was “Next” in the screen 1, has changed to a spinning wheel. This continues spinning. When the spinning button is pressed, my calling app crashes.
I conclude that a certain constellation in the PPCheckout SDK prevents screen 5 to close and continue to screen 6. I expect this to be the primary problem, causing all the trouble. The fact of the crash when the spinning button is pressed, might be a secondary issue.
From other articles about paypal issues I learned that it might be caused also by conflicts with other libraries used in an app. That’s why I list here the frameworks used in my app:
use_frameworks!
pod 'lottie-ios'
pod 'SnapKit', '~> 5.0.0'
pod 'FirebaseAnalytics'
pod 'FirebaseCrashlytics'
pod 'Firebase/Messaging'
pod 'Stripe'
pod 'PayPalCheckout'
pod "Rollbar", "~> 1.4.2"
pod 'Analytics', '~> 4.1'
pod 'AppAuth'
I would like to know whether other developers have experienced the same phenomena already. And of course any hint for a solution would be appreciated.