on master help sign in
Only update badge when key is present
commitaa1b1d52e1dc5744f56e9344b01926f5c41139cd authorSam Tay <sam.chong.tay@gmail.com> dateTue 13 Feb 2018, 19:05 (9 years ago) parentbbc6b24
1 file changed+3−1
jsaddle-wkwebview/cbits-uikit/AppDelegate.m+3−1
jsaddle-wkwebview/cbits-uikit/AppDelegate.m+3−1
@@ -112,7 +112,9 @@ HsStablePtr global_didFailToRegisterForRemoteNotificationsWithError = 0;
112112- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
113113 // Sent when the application receives remote notifications in the foreground or background
114114 // TODO Allow a configurable CString -> IO () to be passed into AppDelegateConfig
115− [UIApplication sharedApplication].applicationIconBadgeNumber=[[[userInfo objectForKey:@"aps"] valueForKey:@"badge"] intValue];
115+ if ([userInfo valueForKeyPath:@"aps.badge"] != nil) {
116+ [UIApplication sharedApplication].applicationIconBadgeNumber=[[[userInfo objectForKey:@"aps"] objectForKey:@"badge"] intValue];
117+ }
116118 completionHandler(UIBackgroundFetchResultNewData);
117119}
118120