I have used remote Notifications in my app but register failed when using iPhone 4 or iPhone 4s. For iPhone 6 and the others, there is no issue in registering. I search the problem on net. It is because of wrong Certificates. So I do not understand it. How can iPhone 6 or iPhone 5 successfully register while iPhone 4 or 4s does not. Maybe it is system version's issue. How can I solve this problem?enter image description here

1

There are 1 best solutions below

1
Ronak Chaniyara On

Try below code :

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }
    else
    {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }