I have problems with receiving push notification token. My app is behaving in a strange way I never encountered before.
App supports iOS 7.0+ and this is how I register to push notifications:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {;
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound];
}
...
}
On iOS 7 everything works fine. App displays alert to the user. If the user approves notifications, the app gets token and all is OK.
On iOS 8 app doesn't received push notification token. App displays alert to the user, but when user approves nothing happens. App doesn't received application: didRegisterForRemoteNotificationsWithDeviceToken:
or application: didFailToRegisterForRemoteNotificationsWithError:
calls.