didRegisterForRemoteNotificationsWithDeviceToken Not Called on iOS 18.1.1

I'm experiencing issues with didRegisterForRemoteNotificationsWithDeviceToken not being called on iOS 18.1.1. Here's what I've tried:

Basic Setup:

  • Properly configured UNUserNotificationCenter
  • Requested permissions with requestAuthorization(options:)
  • Registered for remote notifications with registerForRemoteNotifications()

Environment:

  • Xcode 16.3
  • iOS 18.1.1 (physical device)
  • Firebase (tried with and without it)

Troubleshooting:

  • Verified provisioning profile includes Push Notifications
  • Confirmed APNs certificate is valid
  • Disabled Firebase's method swizzling
  • Tested on a clean project (works fine)
  • Checked device logs (no relevant errors)

Code Snippet:

// In AppDelegate.swift
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }
    let tokenString = tokenParts.joined()
    print("📱 Device Token: \(tokenString)")
    
    // Store the token for your backend
    UserDefaults.standard.set(tokenString, forKey: "deviceToken")
    
    // Send to backend
    Task {
        do {
            try await APIService.shared.setDeviceToken(tokenString)
        } catch {
            print("❌ [AppDelegate] Failed to send device token to backend: \(error)")
        }
    }
}

public func application(_ application: UIApplication, 
                       didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
    // IMPORTANT: First handle push notification registration
    UNUserNotificationCenter.current().delegate = self
    
    // Request notification permissions
    self.requestNotificationPermissions()
    
    // Register for remote notifications
    DispatchQueue.main.async {
        UIApplication.shared.registerForRemoteNotifications()
    }
    
    return true
}

private func requestNotificationPermissions() {
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in
        guard granted else { 
            print("❌ Notification permission not granted")
            return 
        }
        print("✅ Notification permission granted")
    }
}

With Firebase involved, it is not fruitful to look elsewhere as they do swizzle that function away for themselves.

I can't comment on whether your Firebase configuration is in such a state that it could still be taking over or not. You will want to contact their support channels for that.

What I would suggest is to create a small project without Firebase (is that what you mean by a "clean project"?), or just use the sample push notifications project and see if you do get the token.

If you are able to receive a token where Firebase is not involved, then that narrows down the cause, and you should ask Firebase.


Argun Tekant /  DTS Engineer / Core Technologies

didRegisterForRemoteNotificationsWithDeviceToken Not Called on iOS 18.1.1
 
 
Q