ios - didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister...Settings is -


i followed this thread, method didregisterforremotenotificationswithdevicetoken still not called :

the documentation says :

after call registerforremotenotifications method of uiapplication object, app calls method when device registration completes successfully

didregisteruser appears well, not did register notif.

here code in appdelegate (the app version 8.1) :

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     //register notif     uiusernotificationtype usernotificationtypes = (uiusernotificationtypealert |                                                     uiusernotificationtypebadge |                                                     uiusernotificationtypesound);     uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes:usernotificationtypes categories:nil];     [application registerusernotificationsettings:settings];       return yes; }  - (void)application:(uiapplication *)application didregisterusernotificationsettings:(uiusernotificationsettings *)notificationsettings {     //register receive notifications     [application registerforremotenotifications];     nslog(@"didregisteruser"); }  -(void)application:(uiapplication *)application didfailtoregisterforremotenotificationswitherror:(nserror *)error {     nslog(@"error here : %@", error);//not called }  - (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)devicetoken {     /*     // store devicetoken in current installation , save parse.     pfinstallation *currentinstallation = [pfinstallation currentinstallation];     [currentinstallation setdevicetokenfromdata:devicetoken];     currentinstallation.channels = @[ @"global" ];     [currentinstallation saveinbackground];      */     nslog(@"did register notif");//not called } 

i have background mode -> remote notification in info.plist.

your code seems correct. minor improvement write didregisterusernotificationsettings method so:

- (void)application:(uiapplication *)application didregisterusernotificationsettings:(uiusernotificationsettings *)notificationsettings {     if (notificationsettings.types != uiusernotificationtypenone) {         nslog(@"didregisteruser");         [application registerforremotenotifications];     } } 

there may configuration problem causes failed apn registration.

  1. assure provisioning profile contains aps-environment entry

  2. assure have unique app identifier (a string without "*") set in provisioning profile. should use exact identifier "bundle identifier" in info.plist

  3. maybe have declined push-feature after initial installation - in case never see in-app-push-alert again , have enable push in settings app again.

  4. try device.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -