Question: I'm developing an app that uses Firebase push notifications. It worked well until I tried in iOS 11. Using an iphone with ios 11 the notifications don't arrive. Here's my code:

```
- (void)application:(UIApplication *)application 
  didReceiveRemoteNotification:(NSDictionary *)userInfo
  fetchCompletionHandler:(void (^)
  (UIBackgroundFetchResult))completionHandler {
      //Manage notification
  }

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
   willPresentNotification:(UNNotification *)notification
     withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{
    //Manage notification
}

```

Neither of the methods are called.

Thanks for the help!

Answer: 
You need to implement `UNUserNotificationCenterDelegate` 

```
 extension AppDelegate: UNUserNotificationCenterDelegate {
        func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
            completionHandler(.alert)
        }
    }

```

and set it to `UNUserNotificationCenter` object inside `didFinishLaunchingWithOptions`

```
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
      UNUserNotificationCenter.current().delegate = self
      return true
}

```
Can you try this

```
    Messaging.messaging().delegate = self
    Messaging.messaging().shouldEstablishDirectChannel = true

```