Xamarin iOS Firebase DidReceiveRegistrationToken keeps returning invalid token

Hi everyone,

I've encountered a weird issue with FCM which only happened on some iOS devices (1 iPhone and 1 iPad so far). After few days when users updated the app to newer version, the FCM token on those devices became invalid and when we sent notifications to them, we got NotRegistered response.

As you can see my AppDelegate below, we followed exactly Xamarin Documentation to implement FCM:


void RegisterForNotifications()
Messaging.SharedInstance.Delegate = this;

        // Register your app for remote notifications.
        if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            UNUserNotificationCenter.Current.Delegate = this;

            var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
            UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => Console.WriteLine(granted));
            // iOS 9 or before
            var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
            var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);


public void DidReceiveRegistrationToken(Messaging messaging, string fcmToken)
Console.WriteLine($"Firebase registration token: {fcmToken}");
Dependency.DataManager.FCMToken = fcmToken;

It occurred randomly and I cannot find a way to reproduce it on Production. However, when we found 1 device which had same issue but on Staging environment, we debugged inline and saw that DidReceiveRegistrationToken kept returning the invalid value to us. I thought it is handled by Firebase framework and should've always returned a valid token.

Could it be a bug or did I make some mistake here?

FYI, I'm using Xamarin Forms 3.6, Xamarin.Firebase.iOS.CloudMessaging 3.1.2, Xamarin.Firebase.iOS.InstanceID 3.4.0

Thank you.

Sign In or Register to comment.