0

由于我切换到使用PushKit应用程序框架,因此收到推送时没有应用程序徽章更改。

我使用的对 APNS 实施的更改PushKit

  • 在服务器端,我用 VOIP 推送证书替换了 APNS 证书。

  • 在客户端,我替换了:

    1. registerForRemoteNotifications

      PKPushRegistry *pushRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
      
      pushRegistry.delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
      pushRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];`
      
    2. didRegisterForRemoteNotificationsWithDeviceTokendidFailToRegisterForRemoteNotificationsWithErrordidUpdatePushCredentials
    3. didReceiveRemoteNotificationdidReceiveRemoteNotification FetchComplitionHandlerdidReceiveIncomingPushWithPayload

结果,didReceiveIncomingPushWithPayload被调用,我在有效负载字典中看到有效的徽章编号,但不幸的是,应用程序徽章没有改变。

4

1 回答 1

0

在您的方法didReceiveRemoteNotification中,您应该自己更新徽章编号,方法是这样设置:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    [application setApplicationIconBadgeNumber:1];
}
于 2016-04-04T17:55:22.207 回答