title: Xamarin Firebase iOS 11 No FCM Token Generated
body: <p>My app registers with firebase for push notifications, receives a token, and then provides that token as a querystring parameter of the url loaded by a webview.</p>
  
  <p>Although the code executes and no failures are reported, the token is always null in iOS 11. </p>
  
  <p><strong>The below code works on iOS v9.x on either remote simulator or installed on a device, but does not work in either environment when iOS v11.x.</strong></p>
  
  <p>Has anyone experienced this? Anyone have helpful suggestions? Thank you in advance for your assistance, I'm pulling out what's left of my hair over here.</p>
  
  <p>I am using the following packages/versions:</p>
  
  <ul>
  <li>Xamarin.Firebase.iOS.CloudMessaging v2.0.4.1</li>
  <li>Xamarin.Firebase.iOS.Core v4.0.13</li>
  <li>Xamarin.Firebase.iOS.InstanceId v2.0.8</li>
  </ul>
  
  <p>From AppDelegate.cs:</p>
  
  <pre><code>    public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
      {
          // Override point for customization after application launch.
          // If not required for your application you can safely delete this method
  
          // 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) =&gt;
              {
                  System.Console.WriteLine(granted);
              });
  
              // For iOS 10 display notification (sent via APNS)
              UNUserNotificationCenter.Current.Delegate = this;
  
              // For iOS 10 data message (sent via FCM)
              Messaging.SharedInstance.Delegate = this;
          }
          else
          {
              // iOS 9 or before
              var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
              var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);
              UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
          }
  
          UIApplication.SharedApplication.RegisterForRemoteNotifications();
  
          //configure firebase analytics.
          App.Configure();
  
          DoFCMConnect();
          return true;
      }
  
      private void DoFCMConnect()
      {
          Messaging.SharedInstance.ShouldEstablishDirectChannel = true;
  
          Console.WriteLine("Connected to FCM");
  
          //removed when updated to newest firebase version
          //Messaging.SharedInstance.Connect(error =&gt; {
          //    if (error != null)
          //    {
          //        System.Console.WriteLine(String.Format("Re-Connection to FCM Failed: {0}", error.ToString()));
          //    }
          //    else
          //    {
          //        System.Console.WriteLine("Re-Connected to FCM.");
          //    }
          //});
      }
  </code></pre>
  
  <p>From WebViewController.cs:</p>
  
  <pre><code>public override void ViewDidLoad()
      {
          string url = "https://www.mydomainname.com"; // NOTE: https secure request is required.
  
          string token = InstanceId.SharedInstance.Token;
          string fcm = Messaging.SharedInstance.FcmToken;
  
          if (token == null &amp;&amp; fcm != null)
          {
              token = fcm;
          }
  
          if (String.IsNullOrEmpty(token))
          {
              url += "/login";
          }
          else
          {
              url += "/app-in/{0}"; //page accepts token and associates it to the user after login.
              url = String.Format(url, System.Web.HttpUtility.UrlEncode(token));
          }
  
          WebView.LoadRequest(new NSUrlRequest(new NSUrl(url)));
  
      }
  </code></pre>
  
  <p>Both string token and string fcm contain a value for iOS 9, however both are null in iOS 11.</p>