Skip to content

Commit e91a5a9

Browse files
committed
Running setApplicationIconBadgeNumber on mainThread
This is a UIApplication method so we need to run it on the main thread. It can be run on background threads through wrapper SDKs.
1 parent bf135dc commit e91a5a9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,9 @@ + (BOOL)clearBadgeCount:(BOOL)fromNotifOpened {
22212221
bool wasBadgeSet = [UIApplication sharedApplication].applicationIconBadgeNumber > 0;
22222222

22232223
if (fromNotifOpened || wasBadgeSet) {
2224-
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
2224+
[OneSignalHelper runOnMainThread:^{
2225+
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
2226+
}];
22252227
}
22262228

22272229
return wasBadgeSet;

0 commit comments

Comments
 (0)