In APNS, It's not able to get device token in any device except iPhone 4 and didRegisterForRemoteNotificationsWithDeviceToken not executed - Push Notification.
Asked
Active
Viewed 164 times
0
Ekta Padaliya
- 5,743
- 3
- 39
- 51
alzert
- 21
- 2
-
Did you implement? `- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error`. May be you have have error and this helps you to get description of it. – Ekta Padaliya Jul 19 '16 at 10:29
-
@alzert me too facing the same issue from today morning.i am using xcode 7.3.1 and iOS 9.3. – Gokul G Jul 19 '16 at 11:37
-
1this may be problem from apple side .. check this http://stackoverflow.com/a/38456437/4601170 .. production is working fine – Bhavin Bhadani Jul 19 '16 at 11:38
2 Answers
1
Try this...
if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
[application registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
} else {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
}
Andolasoft Inc
- 1,296
- 1
- 7
- 16
0
Try it in App delegate DidFinishLaunchingWithOption : iphone 4 runs on iOS7 only.
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)])
{
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:nil];
[application registerUserNotificationSettings:settings];
}
else
{
// Register for Push Notifications, if running iOS version < 8
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
Sagar Shirbhate
- 801
- 7
- 17