Skip to content

fix: execute notification center completion handlers on the main thread #31

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

Merged
merged 1 commit into from
Apr 30, 2025

Conversation

julien-ctx
Copy link
Contributor

Hi Ortto team 👋

While testing push notifications on iOS, I noticed that the app crashes after tapping on a notification. XCode provided a hint pointing to the MessagingPush+AppDelegate.swift file.

Screenshot_2025-04-04_at_10 47 35

It turns out that the completionHandler is being called off the main thread, which seems to cause issues — probably due to a UI-related action like navigating to a specific tab.

I tried wrapping the completionHandler in DispatchQueue.main.async, and that resolved the crash. To be safe, I applied the same change everywhere completionHandler is used.

The fix has been tested and appears to work well on my side.

Happy to help further if needed — let me know if you have a different approach in mind!

@rlemasquerier
Copy link

Hello @scrummitch , Rodolphe here, I hope you are doing well :)
@julien-ctx is working with me on the flutter SDK integration. I was also facing the same issue and he found this fix which seems to solve the issue on my side as well.

@scrummitch scrummitch merged commit e3a580a into autopilot3:master Apr 30, 2025
2 checks passed
@scrummitch
Copy link
Collaborator

Thank you both @julien-ctx and @rlemasquerier for the PR !

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

Successfully merging this pull request may close these issues.

3 participants