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

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

```

Answer: 
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.
For registering your device with APNs, you will first have to call

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

```

this is usually written in your AppDelegate (in didFinishLaunching ).
Then make sure you have implemented the 

```
didRegisterForRemoteNotificationsWithDeviceToken 

```

which provides you with the device token and

```
didFailToRegisterForRemoteNotificationsWithError

```

which gives you the error your code might have encountered.