I got the device token through didRegisterForRemoteNotificationsWithDeviceToken method. I wanted to use the device token in another method. I tried it in this w
In your app delegate class define method + (CustomAppDelegate *)sharedAppDelegate whose implementation should look like this one:
+ (CustomAppDelegate *)sharedAppDelegate
{
return (CustomAppDelegate *) [UIApplication sharedApplication].delegate;
}
where CustomAppDelegate is name of your app delegate class.
In method your need to get value of str variable you should type following:
NSString *token = [[CustomAppDelegate sharedAppDelegate] str];
where CustomAppDelegate is name of your app delegate class and str is synthesized property (or name of the method) where device token is stored.
Before calling sharedAppDelegate don't forget to import "CustomAppDelegate.h"