ios - Getting a sample Device token -


i trying device token iphone. after reading post in stackoverflow, have done this.

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions  {      [[uiapplication sharedapplication] registerforremotenotificationtypes:uiremotenotificationtypebadge|uiremotenotificationtypealert ]; }   (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)devicetoken  {     nslog(@"didregisterforremotenotificationswithdevicetoken: %@", devicetoken); } 

i have put breakpoint in didregisterforremotenotificationswithdevicetoken, not stopping there. how ensure gets called?

sorry noob question.. need guidance on this...

there may reason this.

either have done wrong while generating .cer file or have not installed new provisioning in xcode deleting old provisioning after configuring app push notification services.

so check once again in provisioning portal while configuring app apple push notification services. , download .cer file again. generate .pem file(it contains private key) .cer file. download new provisioning profile again , remove old provisioning xcode , install new provisioning.

then use :

#pragma mark - #pragma mark push notifications - (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)_devicetoken {     // hex string device token no spaces or < >      nsstring *devicetoken = [[nsstring alloc] init];      devicetoken = [[[[_devicetoken description]                      stringbyreplacingoccurrencesofstring: @"<" withstring: @""]                     stringbyreplacingoccurrencesofstring: @">" withstring: @""]                    stringbyreplacingoccurrencesofstring: @" " withstring: @""];      nslog(@"devicetoken = %@",devicetoken);    } 

hope helps you.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -