Aktualisiere das Abzeichensymbol, wenn die App geschlossen wird
Ich versuche, das Badge-Symbol für meine App zu aktualisieren (geschlossen), wenn ich eine PN erhalten habe.
Ich habe versucht, die Codes hinzuzufügen, aber es funktioniert nicht, wenn meine App geschlossen ist. Es funktioniert, wenn die App im Vordergrund läuft.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSDictionary *remoteNotif = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
//Accept push notification when app is not open
if (remoteNotif) {
[application setApplicationIconBadgeNumber:100];
return YES;
}
}
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 30];
}