ios - Trouble getting device token into global variable -
i trying device token , put device token global variable (or access view). code in appdelgate follows:
- (void)application:(uiapplication*)application didregisterforremotenotificationswithdevicetoken:(nsmutabledata*)devicetoken {     dataclass *obj=[dataclass getinstance];       obj.userdevice = devicetoken;        nslog(@"%@",obj.userdevice);   }   this displays token. when try access through global variable in view, displays "null". code follows:
 dataclass *obj=[dataclass getinstance];   nslog(@"%@",obj.userdevice);   any ideas? or solution? want access token view i'm open other suggestions.
edit: dataclass
   static dataclass *instance =nil;     +(dataclass *)getinstance  {     @synchronized(self)     {         if(instance==nil)         {              instance= [dataclass new];         }     }     return instance; }      
i've found answer. involves saving token user defaults.
Comments
Post a Comment