Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

IOS xamarin firebase notification, my App wont compile and reports this error"

'Messaging' does not contain a definition for 'RemoteMessageDelegate' and no accessible extension method 'RemoteMessageDelegate' accepting a first argument of type 'Messaging' could be found (are you missing a using directive or an assembly reference?)

using System;
using System.Collections.Generic;
using System.Linq;

using Foundation;
using UIKit;
using Firebase.CloudMessaging;
using UserNotifications;

namespace FirebaseXL.iOS
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate, IUNUserNotificationCenterDelegate, IMessagingDelegate
public void DidRefreshRegistrationToken(Messaging messaging, string fcmToken)
System.Diagnostics.Debug.WriteLine($"FCM Token: {fcmToken}");

    // This method is invoked when the application has loaded and is ready to run. In this 
    // method you should instantiate the window, load the UI into it and then make the window
    // visible.
    // You have 17 seconds to return from this method, or iOS will terminate your application.
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)


      //  LoadApplication(new App());

        LoadApplication(application: new FirebaseXL.Forms.App());

        // Register your app for remote notifications.
        if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            // iOS 10 or later
            var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
            UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => {
            // For iOS 10 display notification (sent via APNS)
            UNUserNotificationCenter.Current.Delegate = this;

            // For iOS 10 data message (sent via FCM)
            Messaging.SharedInstance.RemoteMessageDelegate = this;
            // iOS 9 or before
            var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
            var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);
        return base.FinishedLaunching(app, options);


Best Answer


Sign In or Register to comment.