Fix: Check if Push Notifications Are Enabled in iOS

Written by

in

Quick answer: Use UNUserNotificationCenter.current().getNotificationSettings() to retrieve the current authorization status. Check the settings.authorizationStatus property for .authorized, .denied, or .notDetermined to know if push notifications are enabled for your app.

Why this happens

Apps need to know whether the user has granted permission for push notifications to adjust behavior—such as showing an in-app prompt, disabling notification-dependent features, or guiding the user to Settings. Historically, developers used UIApplication.shared.enabledRemoteNotificationTypes() (deprecated in iOS 8) or isRegisteredForRemoteNotifications (which only tells you if the app successfully registered with APNs, not whether the user actually allowed alerts). The modern, reliable way is to query the user notification settings through UNUserNotificationCenter.

How to fix it

1. Use UNUserNotificationCenter to get current settings (recommended)

This approach works on iOS 10+ and returns the exact authorization state the user chose in Settings.

import UserNotifications

func checkPushNotificationStatus(completion: @escaping (UNAuthorizationStatus) -> Void) {
    UNUserNotificationCenter.current().getNotificationSettings { settings in
        DispatchQueue.main.async {
            completion(settings.authorizationStatus)
        }
    }
}

// Usage
checkPushNotificationStatus { status in
    switch status {
    case .authorized:
        print("Push notifications are enabled")
    case .denied:
        print("User denied push notifications")
    case .notDetermined:
        print("User hasn't been asked yet")
    case .provisional:
        print("Provisional authorization (iOS 12+)")
    case .ephemeral:
        print("Ephemeral authorization (App Clips)")
    @unknown default:
        print("Unknown status")
    }
}

The authorizationStatus enum gives you precise information:
– authorized – User allowed notifications (any style).
– denied – User explicitly turned them off.
– notDetermined – App hasn’t requested permission yet.
– provisional – Quiet delivery granted (iOS 12+).
– ephemeral – Temporary permission for App Clips.

2. Check for specific alert style (banners/alerts vs. none)

If you only care whether visual alerts (banners or alerts) are on—ignoring sounds/badges—inspect alertSetting:

UNUserNotificationCenter.current().getNotificationSettings { settings in
    let alertsEnabled = settings.alertSetting == .enabled
    // alertsEnabled is true for Banners or Alerts, false for None
}

This mirrors the old bitwise check types & UIRemoteNotificationTypeAlert but uses the current API.

3. Legacy fallback (iOS 8–9 only)

If you must support iOS 8 or 9, the deprecated property still works but will be removed in future SDKs:

// Deprecated – avoid in new code
let types = UIApplication.shared.enabledRemoteNotificationTypes
let hasAlerts = types.contains(.alert)

Prefer the UNUserNotificationCenter method above; it covers all supported iOS versions.

How to prevent it

  • Request notification permission early with a clear explanation of why your app needs it.
  • Handle .denied gracefully: show a friendly in-app message with a deep link to Settings (UIApplication.openSettingsURLString).
  • Re-check status after the user returns from Settings; don’t cache the result indefinitely.
  • Use provisional authorization (.provisional) for non-intrusive delivery if appropriate.

FAQ

Does isRegisteredForRemoteNotifications tell me if the user enabled notifications?

No. It only indicates whether the app successfully registered with Apple Push Notification service (APNs) and received a device token. The user may still have disabled alerts, sounds, or badges in Settings.

Can I detect notification status without importing UserNotifications?

Not reliably on modern iOS. UNUserNotificationCenter is the supported API since iOS 10. The older UIApplication methods are deprecated and may return incomplete information.

What if the user changes the setting while my app is running?

The system will relaunch or resume your app. Listen for UIApplication.didBecomeActiveNotification (or sceneDidBecomeActive) and re-query getNotificationSettings to get the latest state.

Sources & credits

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