0

アプリケーションのフレームワークを使用するように切り替えたのでPushKit、プッシュ受信時にアプリ バッジの変更はありません。

使用するために行った APNS 実装への変更PushKit:

  • サーバー側では、APNS 証明書を VOIP プッシュ証明書に置き換えました。

  • クライアント側では、次を置き換えました:

    1. registerForRemoteNotifications

      PKPushRegistry *pushRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
      
      pushRegistry.delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
      pushRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];`
      
    2. didRegisterForRemoteNotificationsWithDeviceTokenそしてdidFailToRegisterForRemoteNotificationsWithError_didUpdatePushCredentials
    3. didReceiveRemoteNotificationそしてdidReceiveRemoteNotification FetchComplitionHandler_didReceiveIncomingPushWithPayload

その結果、didReceiveIncomingPushWithPayloadが呼び出され、ペイロード ディクショナリに有効なバッジ番号が表示されますが、残念ながらアプリ バッジは変更されません。

4

1 に答える 1

0

methoddidReceiveRemoteNotificationでは、次のように設定してバッジ番号を自分で更新する必要があります。

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