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];
}
}