Register successed ,but didRegisterForRemoteNotificationsWithDeviceToken called twice

183 Views Asked by At

my app launched every times,the didRegisterForRemoteNotificationsWithDeviceToken always be called twice,the push can be sent and receive normally

code:
// launch method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (iOS8_OR_LATER)
{
   // register remote notification
   [[UIApplication sharedApplication] registerForRemoteNotifications];
   [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert categories:nil]];
}
else
{
   // register remote notification
   [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert];
}
}
0

There are 0 best solutions below