3

All are working fine upto today morning, I need device token to move forward When I debug on the iOS device niether didRegisterForRemoteNotificationsWithDeviceToken nor didFailToRegisterForRemoteNotificationsWithError method is never fired off. I will really appreciate some help. My code follows.

        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0){

        UIUserNotificationType types = UIUserNotificationTypeBadge |
        UIUserNotificationTypeSound | UIUserNotificationTypeAlert;

        UIUserNotificationSettings *mySettings =
        [UIUserNotificationSettings settingsForTypes:types categories:nil];

        [application registerUserNotificationSettings:mySettings];
        //[application registerForRemoteNotifications];


    }else{
        [application registerForRemoteNotificationTypes:
         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }
    return YES;
    }

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken: %@", deviceToken);
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
    NSString *deviceID = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
    deviceID = [deviceID stringByReplacingOccurrencesOfString:@" " withString:@""];

    NSLog(@"Device_Token     -----> %@\n",deviceID);
    [[NSUserDefaults standardUserDefaults] setObject:deviceID forKey:@"KiviDeviceToken"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    NSLog(@"Error: %@", error.description);

    if (error.code == 3010) {
        NSLog(@"Push notifications are not supported in the iOS Simulator.");
    } else {
        NSLog(@"application:didFailToRegisterForRemoteNotificationsWithError: %@", error);
    }
}

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
    NSLog(@"NotificationSettings: %@", notificationSettings);
    //register to receive notifications
    [application registerForRemoteNotifications];
}

I have checked iOS settings app notifications are enabled, that method will not get called

I need some help for "Troubleshooting Push Notifications" "If neither delegate callback application:didRegisterForRemoteNotificationsWithDeviceToken: nor application:didFailToRegisterForRemoteNotificationsWithError: is called, NotificationSettings are getting I think call back is not calling because connection is not yet been establihed."

1 Answers1

0

There has been issues on Apples end with APNS. For some reason apps in production work fine, but apps which people are developing won't push any notifications whatsoever.

Click here for more info

Community
  • 1
  • 1
Konsy
  • 306
  • 3
  • 22