Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using async version of presentCheckoutPreferences() #159

Open
cwimberger opened this issue Dec 4, 2024 · 0 comments
Open

Crash when using async version of presentCheckoutPreferences() #159

cwimberger opened this issue Dec 4, 2024 · 0 comments

Comments

@cwimberger
Copy link

When using the async version of presentCheckoutPreferences() and a reader is selected, the app crashes with
Thread 1: EXC_BAD_ACCESS (code=1, address=0x28)
as soon as the Done button is tapped to close the view controller.

After further investigation, we discovered that the completion block of the older non-async presentCheckoutPreferences() is called multiple times. That might be the issue in the SDK.

As a workaround, we use the following code:

static func presentCheckoutPreferencesFixed(from vc: UIViewController, animated: Bool) async throws -> Bool {
     return try await withCheckedThrowingContinuation { @MainActor cont in
         var resumed = false
         
         self.presentCheckoutPreferences(from: vc, animated: animated) { @MainActor success, err in
             if resumed { return }
             resumed = true
             
             if let err {
                 cont.resume(throwing: err)
             } else {
                 cont.resume(returning: success)
             }
         }
     }
 }

It would be great if you can fix this issue in the SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant