NOTE: This was apparently due to some sort of corruption in the Settings, the code was apparently fine all along...
Following the conversation in this thread: Remote Notification iOS 8, I added this boilerplate code to my app:
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIRemoteNotificationTypeBadge categories:nil]];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];
}
if ([[inLaunchOptions allKeys] containsObject:UIApplicationLaunchOptionsRemoteNotificationKey]) {
[appTracking registerPush:[inLaunchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]];
}
I also added the application:didRegisterUserNotificationSettings
handler, which calls a single line of code, [application registerForRemoteNotifications]
. This code is called when the app starts.
Reading that thread, it is suggested that this is all that is required, and that this will cause application:didRegisterForRemoteNotificationsWithDeviceToken
to be called. But that is definitely not happening in my app.
Did I miss a step, or simply mis-understand how to set this up?