objective c - Device is Registered for notification but did not get device token -
here code
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { if ([[[uidevice currentdevice] systemversion] floatvalue] >= 8.0) { [[uiapplication sharedapplication] registerusernotificationsettings:[uiusernotificationsettings settingsfortypes: (uiusernotificationtypealert | uiusernotificationtypebadge | uiusernotificationtypesound) categories:nil]]; [[uiapplication sharedapplication] registerforremotenotifications]; } else { [[uiapplication sharedapplication] registerforremotenotificationtypes: (uiusernotificationtypebadge | uiusernotificationtypesound | uiusernotificationtypealert)]; } [application registerforremotenotifications]; return yes; } - (void)application:(uiapplication *)application didregisterusernotificationsettings:(uiusernotificationsettings *)notificationsettings { //register receive notifications nslog(@"device registered..."); [application registerforremotenotifications]; } - (void)application:(uiapplication*)application didregisterforremotenotificationswithdevicetoken:(nsdata*)devicetoken { // [[uiapplication sharedapplication] setapplicationiconbadgenumber:0]; nsstring *deviceid = [[devicetoken description] stringbytrimmingcharactersinset:[nscharacterset charactersetwithcharactersinstring:@"<>"]]; deviceid = [deviceid stringbyreplacingoccurrencesofstring:@" " withstring:@""]; str_devicetoken = deviceid; nslog(@"device token %@",str_devicetoken); }
i neither device token error nor device token when run code device.
i spent day behind find issue please device token.
thanks in advance
Comments
Post a Comment