Fix: registerForRemoteNotificationTypes Not Supported in iOS 8 and Later

Fix: registerForRemoteNotificationTypes Not Supported in iOS 8 and Later

Written by

in

Quick answer: The method registerForRemoteNotificationTypes: was deprecated in iOS 8. Replace it with registerUserNotificationSettings: followed by registerForRemoteNotifications. Use a runtime selector check to maintain compatibility with iOS 7.

Why this happens

Apple overhauled the notification permission model in iOS 8. The legacy registerForRemoteNotificationTypes: call assumed the app could request alert, badge, and sound permissions in a single step. Starting with iOS 8, the system separates user-visible notification settings (alerts, banners, sounds, badges) from the remote-notification token registration. Calling the old selector on iOS 8+ triggers the runtime error:

registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.

If you compile with the iOS 8 SDK (Xcode 6 or later) but still link against the old symbol, you may also hit a dyld: Symbol not found: _OBJC_CLASS_$_UIUserNotificationSettings crash on iOS 7 devices because the class simply doesn’t exist there.

How to fix it

1. Runtime selector check (recommended for Xcode 6+)

This approach works whether you build with the iOS 8 SDK or later. It asks the running UIApplication instance whether it understands the new API and falls back gracefully.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
        // iOS 8 and later
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:
            (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound)
            categories:nil];
        [application registerUserNotificationSettings:settings];
        [application registerForRemoteNotifications];
    } else {
        // iOS 7 and earlier
        [application registerForRemoteNotificationTypes:
            (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
    }
    return YES;
}

Why this works: registerUserNotificationSettings: prompts the user for permission to show notifications. Only after the user grants permission (delivered via application:didRegisterUserNotificationSettings:) does the subsequent registerForRemoteNotifications call request the device token from APNs.

2. Compile-time guard for mixed Xcode 5 / Xcode 6 teams

If some developers still use Xcode 5 (which lacks the iOS 8 SDK), wrap the new symbols in a macro guard so the project compiles everywhere:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:
        (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound)
        categories:nil];
    [application registerUserNotificationSettings:settings];
    [application registerForRemoteNotifications];
} else {
    [application registerForRemoteNotificationTypes:
        (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
}
#else
[application registerForRemoteNotificationTypes:
    (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
#endif

The __IPHONE_OS_VERSION_MAX_ALLOWED macro reflects the base SDK version, not the deployment target. This lets Xcode 5 builds skip the unavailable symbols entirely while Xcode 6+ builds include the runtime branch.

3. Handle the callback for iOS 8+

On iOS 8 and later you must implement the new delegate method to know when the user has responded to the permission prompt:

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
    // User tapped Allow or Don't Allow; now request the device token
    [application registerForRemoteNotifications];
}

Without this, registerForRemoteNotifications may be called before the user has granted permission, and the token request will silently fail.

4. Swift equivalent (for mixed-language projects)

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    if #available(iOS 8.0, *) {
        let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
        application.registerUserNotificationSettings(settings)
        application.registerForRemoteNotifications()
    } else {
        application.registerForRemoteNotificationTypes([.alert, .badge, .sound])
    }
    return true
}

// iOS 8+ callback
func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
    application.registerForRemoteNotifications()
}

Swift’s #available check compiles cleanly on all deployment targets and removes the need for manual selector tests.

How to prevent it

  • Adopt the UserNotifications framework (iOS 10+) for new projects; it unifies local and remote notifications and eliminates version branching.
  • Set a minimum deployment target of iOS 9 or later if you no longer need iOS 7/8 support—this removes the legacy path entirely.
  • Test on the oldest supported OS version in CI; the dyld crash only appears on devices running iOS 7.
  • Migrate to Swift where #available makes version checks safer and more readable.

FAQ

Does this fix work for iOS 10 and later?

The code above works through iOS 9. Starting with iOS 10, Apple introduced the UNUserNotificationCenter API, which replaces UIUserNotificationSettings. For iOS 10+ you should migrate to the UserNotifications framework, but the runtime check shown here remains harmless—it simply won’t be executed on iOS 10 because registerUserNotificationSettings: is still present (though deprecated).

Why do I still get a device token on iOS 7 without calling registerForRemoteNotifications after the settings call?

On iOS 7 there is no separate permission prompt. registerForRemoteNotificationTypes: both asks the user (via the system alert) and requests the token in one step. The two-step dance (registerUserNotificationSettings: → registerForRemoteNotifications) is only required on iOS 8+.

Can I use categories with the legacy path?

No. UIUserNotificationCategory (for actionable notifications) is an iOS 8 feature. If you need categories, you must require iOS 8 as your minimum deployment target and drop the iOS 7 fallback entirely.

Sources & credits

Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.