title: Firebase FCM push notifications stopped working iOS 11.1.1
body: <p>I am using Firebase FCM to send push notifications from an iOS device. The push notifications did work, until yesterday.</p>
  
  <p>When I now send a push notification, everything shows successful, but nothing is received on the device.</p>
  
  <p>If I send directly via a curl request, this is the response:</p>
  
  <pre><code>{"multicast_id":7815294000653973158,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1510474219556035%ca9ff0f8ca9ff0f8"}]}
  </code></pre>
  
  <p>If I send from the Notification dashboard on the firebase console, it shows successfully completed.</p>
  
  <p>I have done the following with no success:</p>
  
  <ol>
  <li>Locked in pod for 'FirebaseInstanceID', "2.0.0", as per <a href="https://stackoverflow.com/questions/46391818/fcm-push-notifications-do-not-work-on-ios-11">FCM Push notifications do not work on iOS 11</a></li>
  <li>Generated a new APN key on developer console and replaced the existing key on FCM setup in Firebase</li>
  <li>Downloaded a fresh GoogleService-Info.plist and replaced existing</li>
  <li>Checked that bundle id's etc all match</li>
  <li>Updated firebase pods to latest:</li>
  </ol>
  
  <blockquote>
    <p>Using Firebase (4.5.0)
    Using FirebaseAnalytics (4.0.4)
    Using FirebaseAuth (4.3.1)
    Using FirebaseCore (4.0.10)
    Using FirebaseFirestore (0.9.1)
    Using FirebaseInstanceID (2.0.5)
    Using FirebaseMessaging (2.0.6)</p>
  </blockquote>
  
  <ol start="6">
  <li>Turned message swizzling on and off</li>
  <li>Setting <code>Messaging.messaging().shouldEstablishDirectChannel = true</code> as per <a href="https://stackoverflow.com/questions/46345500/firebase-notifications-not-working-in-ios-11">Firebase notifications not working in iOS 11</a></li>
  <li>Deleted this iOS app from firebase console and redone notification setup from the start</li>
  <li>Made sure remote notification in Capabilities are still turned on</li>
  <li>Restarted my devices</li>
  </ol>
  
  <p>My setup:
  I call FirebaseApp.configure() in the AppDelegate file in the override init() method:</p>
  
  <pre><code>  override init() {
      super.init()
      FirebaseApp.configure()
    }
  </code></pre>
  
  <p>In the AppDelegate didFinishLaunchingWithOptions:</p>
  
  <pre><code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool {
  
      // get push notification token id for user
      if #available(iOS 10.0, *) {
          // For iOS 10 display notification (sent via APNS)
          UNUserNotificationCenter.current().delegate = self
  
          let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
          UNUserNotificationCenter.current().requestAuthorization(
              options: authOptions,
              completionHandler: {_, _ in })
      } else {
          let settings: UIUserNotificationSettings =
              UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
          application.registerUserNotificationSettings(settings)
      }
  
      application.registerForRemoteNotifications()
  
      return true
  }
  </code></pre>
  
  <p>And then I save my token in userdefaults and persist to database later:</p>
  
  <pre><code>func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
      if let refreshedToken = InstanceID.instanceID().token() {
          defaults.set(refreshedToken, forKey: Constant.UserDefaults.token)
          print("Token generated: ", refreshedToken)
      } else {
          print("Could not save token becuase error with instance id token")
      }
  }
  </code></pre>
  
  <p>The token generated here I also test with curl as mentioned above and all shows successful.</p>
  
  <p>My GoogleService-Info.plist:
  <a href="https://i.stack.imgur.com/xpPRf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xpPRf.png" alt="enter image description here"></a></p>
  
  <p>My Info.plist:
  <a href="https://i.stack.imgur.com/kVvqS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kVvqS.png" alt="enter image description here"></a></p>
  
  <p>Please let me know if any other info is required.</p>
  
  <p>My Android application is still working as before. I am struggling to understand what could change for the iOS app in one day to cause this, or what I perhaps broke in one day:)</p>
  
  <p>Any help would be greatly appreciated.</p>