2 lantianyiming lantianyiming 于 2013.07.23 17:22 提问

app关闭时更新徽章图标

实现在接受到PN时更新徽章图标。

我试过添加代码但是在应用关闭后无法实现,只有在应用前台运行时才能实现。

- (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];
    }
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!