I'am trying to get the device token so I can send a notification to it but i keep getting the error "enabledRemoteNotificationTypes is not supported in iOS 8.0 and later."
The device is registered as I can turn the notifications off and on in the notification settings on the phone. This is the code i'm using to try and retrieve the token:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString *str = [NSString stringWithFormat:@"Device Token=%@",deviceToken];
NSLog(@"This is device token%@", deviceToken);
}
im registering the device with this code:
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
// iOS 8 Notifications
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[application registerForRemoteNotifications];
NSLog(@"ios 8+: %@");
}
else
{
// iOS < 8 Notifications
[application registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
NSLog(@"< ios 8+: %@");
}
Ideally i'd like to retrieve the device tokens and send them to a mysql database, have no clue how to do this as i'm a web developer and not too familiar with Objective C