In my app I currently update the application badge after certain events using this code which works:
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
However [UIApplication sharedApplication] cannot be called from WatchKit or the Widget. Is there a way for my widget to update the application badge by some other way?
I tried using a background fetch like this. The badge gets updated when I explicitly "Simulate Background fetch" from Xcode. But on the actual device the background fetch never gets called? Another idea is a command to call the background fetch?
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
// Background Fetch
[[GlobalNotifications sharedInstance] setApplicationBadge];
completionHandler(UIBackgroundFetchResultNewData);
}
Thanks for any insight on this.