iOS11 Remote registration callbacks not called when notifications AND background refresh are disabled.

Originator:Michael.John.Kirk
Number:rdar://34910990 Date Originated:
Status:Open Resolved:
Product:iOS SDK Product Version:iOS11
Classification:bug Reproducible:Always
 
Area:
Notifications

Summary:

We are promised that, provided we've met some preconditions, when we call `[application registerForRemoteNotifications]` the app delegate will soon call one of:

1. `application:didFailToRegisterForRemoteNotificationsWithError:`
2. `application:didRegisterForRemoteNotificationsWithDeviceToken:`

* preconditions:
1. registered user notification settings
2. are online
3. implemented the delegate methods

This has held true for us on iOS8/9/10. However, on iOS11.0 and iOS11.1, this does not happen when the user has disabled all Notifications and disabled "Background App Refresh".

This is similar to the behavior seen on prior versions of iOS when the app calls `registerForRemoteNotifications` *before* calling registerUserNotificationSettings:`, but in this case we *have* called `registerUserNotificationSettings` (and met the other preconditions).

Steps to Reproduce:

1. Go to Settings.app > MyApp 
2. Disable "Background App Refresh"
3. Go to Settings.app > MyApp > Notifications 
4. Disable "Allow Notifications"
5. call 

```
Call:

[UIApplication.sharedApplication registerUserNotificationSettings:]

In  AppDelegate.h

```
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
    NSLog(@"This is called.");
    [UIApplication.sharedApplication registerForRemoteNotifications]
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  NSLog(@"This is never called.");
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error 
{
  NSLog(@"This is never called.");
}
```

Expected Results:

Per documentation, one of the following should be called:
1. `application:didFailToRegisterForRemoteNotificationsWithError:`
2. `application:didRegisterForRemoteNotificationsWithDeviceToken:`

Docs:

```
// Calling this will result in either application:didRegisterForRemoteNotificationsWithDeviceToken: or application:didFailToRegisterForRemoteNotificationsWithError: to be called on the application delegate. Note: these callbacks will be made only if the application has successfully registered for user notifications with registerUserNotificationSettings:, or if it is enabled for Background App Refresh.
- (void)registerForRemoteNotifications NS_AVAILABLE_IOS(8_0);
```

Actual Results:

Neither are called.

Version/Build:

Version: iOS 11.0.1 
Build: 15A402

Version: iOS 11.1 Beta 
Build: 15B5078e

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!