I got the device token through didRegisterForRemoteNotificationsWithDeviceToken
method. I wanted to use the device token in another method. I tried it in this w
You can add the device token to the NSUserDefaults
dictionary like so:
-(void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
[[NSUserDefaults standardUserDefaults] setObject:deviceToken forKey:@"deviceToken"];
This can then be accessed in other methods like so:
NSString *deviceToken = [[NSUserDefaults standardUserDefaults] objectForKey:@"deviceToken"];