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

didregisterforremotenotificationswithdevicetoken not called swift 4
ios 13 didregisterforremotenotificationswithdevicetoken
registerforremotenotifications not working
didregisterforremotenotificationswithdevicetoken not called ios 13 objective c
didregisterforremotenotificationswithdevicetoken called multiple times
didregisterforremotenotificationswithdevicetoken example
remote notifications are not supported in the simulator
push notification not working swift

I followed this thread, but the method didRegisterForRemoteNotificationsWithDeviceToken is still not called :

the documentation says :

After you call the registerForRemoteNotifications method of the UIApplication object, the app calls this method when device registration completes successfully

didRegisterUser appears well, but not did register notif.

Here is my code in the AppDelegate (the app version is 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 to 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 the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    currentInstallation.channels = @[ @"global" ];
    [currentInstallation saveInBackground];
     */
    NSLog(@"did register notif");//not called
}

I also have background mode -> remote notification in the info.plist.

Your code seems to be correct. As a minor improvement you could write your didRegisterUserNotificationSettings method like so:

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
    if (notificationSettings.types != UIUserNotificationTypeNone) {
        NSLog(@"didRegisterUser");
        [application registerForRemoteNotifications];
    }
}

There may be a configuration problem that causes a failed APN registration.

  1. Assure that your Provisioning Profile contains the aps-environment entry

  2. Assure that you have a unique App Identifier (a string without any "*") set in your Provisioning Profile. You should also use this exact identifier as "Bundle identifier" in your Info.plist

  3. Maybe you have declined the Push-Feature after the initial installation - in this case you will never see the in-app-push-alert again and have to enable Push in the settings app again.

  4. Try another device.

ios didRegisterForRemoteNotificationsWithDeviceToken not called , ios didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegisterSettings is? I had this issue and finally found the note in Apple  First of all, I am on iPhone 6 Plus/iOS 8.1 and I've tried everything here: why didRegisterForRemoteNotificationsWithDeviceToken is not called Still no avail. To

After a long dig I found that on 19 July, 2016 due to some error or updation at Apple's end , the didRegisterForRemoteNotificationsWithDeviceToken method would not be called even if every condition like Internet connection , Device and the methods used are perfect.

Refer to this link for confirmation https://forums.developer.apple.com/thread/52224

To verify please have a look in your other apps too. I had wasted my several hours but hope it helps someone. Thanks.

Why can I not register for push notifications?, didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegisterSettings is. Question. I followed this thread, but the method  This question already has an answer here: didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister…Settings is 10 answers First of all

For 19 July, 2016:-

As per Apple Developer form, there is an issue regarding Sandbox APNS down... so there may be issue from apple side,thats why delegates like application:didRegisterForRemoteNotificationsWithDeviceToken: and application:didFailToRegisterForRemoteNotificationsWithError: is not called..

To check current status of APNS Sandbox this link... By now according to status APNS Sandbox is working fine and its normal ... so may be there is some other bug from apple side

So just don't worry if your methods are perfect and certificates are valid. This is just an issue from Apple side .. as soon as issue solved, your methods works perfectly(if everything is fine from your side).

Note that Production is working fine .. so issue is regarding only Sandbox APNS.

Didregisterforremotenotificationswithdevicetoken not called swift, When you register for push notifications, one of two methods ought to be called: didRegisterForRemoteNotificationsWithDeviceToken is called  Both methods are called here. And device DOES receive push notifications. Then I checked on simulator ios 8. In this case the same as in 1st. Only one method is called. I checked some answers for similar question but they didn't help me. I doubt that the issue is somewhere within push notifications settings, cuz ios 9 works OK. So the issue is

I had this issue and finally found the note in Apple Developer web site and solved this issue:

Registering, Scheduling, and Handling User Notifications

iOS Note in the section: "Registering for Remote Notifications:

iOS Note: If a cellular or Wi-Fi connection is not available, neither the application:didRegisterForRemoteNotificationsWithDeviceToken: method nor the application:didFailToRegisterForRemoteNotificationsWithError: method is called. For Wi-Fi connections, this sometimes occurs when the device cannot connect with APNs over port 5223. If this happens, the user can move to another Wi-Fi network that isn’t blocking this port or, on an iPhone or iPad, wait until the cellular data service becomes available. In either case, the device should be able to make the connection, and then one of the delegation methods is called.

My iPhone only connected with Wifi, reboot iPhone and reconnect to WiFi AP solved this issue.

IOS 11 didRegisterForRemoteNotificationsWithDeviceToken not called, This question already has an answer here: didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister…Settings is 10 answers First  En mi caso, después de iOS 9.3, creo. Si utilicé Localytics, no se llamará a didRegisterForRemoteNotificationsWithDeviceToken. Tengo que eliminar esto de mi

XCode 8.3.1 onwards

After trying out all the above options, if the delegate method is still not called, make sure in the project,

under 'Capabilities', (next to General), 
 - Push Notifications option is turned ON`
- and under Background Modes, Remote Notifications is turned ON

didRegisterForRemoteNotificationsWithDeviceToken is not calling , This question already has an answer here: didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister…Settings is 11 answers First  For 19 July, 2016:- There may be issue from apple side,that is why delegates not called check this link – EI Captain v2.0 Jul 19 '16 at 11:23

ios: iOS registerForRemoteNotifications does not generate an error , didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister…Settings is. I followed this thread, but the method  There are a lot of questions about didRegisterForRemoteNotificationsWithDeviceToken but they all sidestep a very direct question which I cannot seem to find an exact

Closed 3 years ago. didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister…Settings is (11 answers). All are working fine upto​  all. I want to ask you about push notification settings. Environments: MacOS[High Sierra10.13.3] Xcode9.2(9C40b) Devices - iPhone6S[iOS10.3.3] - iPhoneX [iOS11.2.6] Language: Cocos2d-x

All are working fine upto today morning, I need device token to move forward When I debug on the iOS device niether didRegisterForRemoteNotificationsWithDeviceToken nor

Comments
  • For 19 July, 2016:- There may be issue from apple side,that is why delegates not called... check this link
  • Guys just wanna let you know that APNS is working properly now. My delegates are getting called properly and I am receiving notifications. Indeed it was an issue at Apple's end but now Remote Notifications service is working fine.
  • @rahulgarg good to know :)
  • Try setting "iOS Distribution" as Code Signing Identity for Release Configuration in the Push1-Target's build settings. Else there seems to be no problem with your project. You just have to make sure that your Profile is correctly set up and that XCode uses this profile when building. You can force XCode to do this by setting "Provisioning Profile" in the Executable Target's build settings (section "Code Signing").
  • Thanks, I appreciate your help. I don't know, it does not work. I tried with another project. Would you mind trying in a new project and see if the steps work for you? I followed these steps: provisioning profile, background mode (remote notification), the code in AppDelegate, the settings in "code signing" for debug / release, the provisioning field is set to the correct one too. And the first time the app is launched, it asks me if I want to allow push, I say "ok". But I only receive "didRegisterUser". No errors.
  • Hi, the problem was... the device. There was a problem with the network, I received all the iMessages, sometimes five days after they were sent. I tried again, and now it works. I had to switch off and on the device. Thank you very much for your answer.
  • I having this issue but in 8.1 it is working fine. but 8.3 not calling the ' didRegisterForRemoteNotificationsWithDeviceToken' method.
  • Good tips on troubleshooting this issue. I would just like to add that a valid troubleshooting step (and the one that ultimately worked for me) is simply to restart your device and/or restart XCode.
  • how can we register device then?
  • Please have patience , I have reported bug at Apple , hope they fix it as soon as possible.
  • I had also spend time to rectify the issue but I am agree with Kunal that APNS service is not working right now, Though apple system status show it is working.
  • Thanks, I was starting to freak out about this.
  • @KunalGupta, can you post the link of your bug which you reported to Apple?