Skip to content

clearAllNotifications on main thread throwing error. - Corrected #314

@Wade-BuildOtto

Description

@Wade-BuildOtto

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions