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

clearAllNotifications on main thread throwing error. - Corrected #314

Open
Wade-BuildOtto opened this issue Jul 2, 2024 · 0 comments
Open

Comments

@Wade-BuildOtto
Copy link

Describe the bug

clearAllNotifications method is attempting to modify the user interface from a background thread. This operation should only be performed on the main thread.

src/ios/FCMPlugin.m - line 98
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

// Ensure UI updates are made on the main thread
dispatch_async(dispatch_get_main_queue(), ^{ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; });

•	The dispatch_async(dispatch_get_main_queue(), ^{...}); block ensures that setApplicationIconBadgeNumber: is called on the main thread.
•	The rest of the code, including logging and sending the plugin result, runs in the background.
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