tags:

views:

496

answers:

2

I Have implemented following code but not getting the Device Token?

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    NSLog(@"deviceToken: %@", deviceToken);
}
A: 

If you don't already, you should have a call to registerForRemoteNotificationTypes in your didFinishLaunchingWithOptions. Something along the lines of:

[[UIApplication sharedApplication]
     registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
              UIRemoteNotificationTypeSound |
              UIRemoteNotificationTypeAlert)];

You should also have a didFailToRegisterForRemoteNotificationsWithError method that gets called if registration fails. The NSerror it gets should tell you more about why it might be failing.

Ramin
A: 

Are you trying inside of the simulator ? Push notification and related appdelagate events doesn't work on simulator.

If you are using the device, Make sure that bundle identifier of your application must be same with your push ssl bundle identitifier which you defined during creating AppID on iphone privisioning protal.

fyasar