9

I have a strange issue, Some of my users are returning blank (or null) device tokens for Apple Push Notification. It happening only some of user's only not for all user's,

Here's my code,

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

   #if !TARGET_IPHONE_SIMULATOR

       [_globalKRData setPreferences:deviceToken withKey:kPushToken]; // Preferences 

       PFInstallation *currentInstallation = [PFInstallation currentInstallation];
       [currentInstallation setDeviceTokenFromData:deviceToken];
currentInstallation.channels = @[@"global"];
       [currentInstallation saveInBackground];

    #endif

}

Is it possible if device is Jail break that's why i getting nil device token ?

Update

For example First time user allowing push notification and it works properly,

Now user go to setting and disable the notification from setting's

Disable notification

Then after it i will not get device token that was fine but problem is now user uninstall the app,

Then after Download the app again then after didRegisterForRemoteNotificationsWithDeviceToken not called so i getting nil device token and when i check setting it will showing notification on

Mayank Patel
  • 3,868
  • 10
  • 36
  • 59

1 Answers1

3

In iOS8 I have deleted my app before that i turn OFF the notification,then i run my application did register is not called,then i again go to the settings and find that Allow notification is ON, but the "didRegisterForRemoteNotification" didn't get a call,

Then I turn "Allow notification" to OFF and again i turn it ON, then i come to my app I found the device token, But its working fine after that, but user have to turn it off by manually and again he has to turn it on, of course its a bug of apple,

It will work fine in iOS 9

satheesh
  • 2,770
  • 2
  • 14
  • 19