title: Firebase - Cannot assign value of type 'AppDelegate' to type 'UNUserNotificationCenterDelegate?'
body: <p>I always get compiling erros when deploying firebase using this tutorial:
  <a href="https://firebase.google.com/docs/cloud-messaging/ios/client" rel="noreferrer">https://firebase.google.com/docs/cloud-messaging/ios/client</a>
  My deployment SDK is 9.0.</p>
  <h1><strong>Errors I get:</strong></h1>
  <p>How can I fix this?</p>
  <blockquote>
  <p>Cannot assign value of type 'AppDelegate' to type 'UNUserNotificationCenterDelegate?'</p>
  </blockquote>
  <h1>1st scenario - What I did step by step (following the tutorial):</h1>
  <ul>
  <li>pod init with the following:
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'</li>
  <li>pod install</li>
  <li>&quot;import Firebase&quot; on top of AppDelegate class</li>
  </ul>
  <h1>2nd scenario - Downloaded google demo iOS client app through a github repository (&quot;messaging&quot; folder under <a href="https://github.com/firebase/quickstart-ios" rel="noreferrer">https://github.com/firebase/quickstart-ios</a>)</h1>
  <ul>
  <li>compiled their app... worked fine.</li>
  <li>compied to my existing XCode project their logic as according to the following steps:</li>
  <li>pod init with the following: pod 'Firebase/Messaging'</li>
  <li>pod install</li>
  <li>imported the following: UIKit, UserNotifications, Firebase, FirebaseInstanceID, FirebaseMessaging</li>
  </ul>
  <p>Code in AppDelegate:</p>
  <pre><code>func application(_ application: UIApplication,
                       didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool {
          // [START register_for_notifications]
          if #available(iOS 10.0, *) {
              let authOptions : UNAuthorizationOptions = [.alert, .badge, .sound]
              UNUserNotificationCenter.current().requestAuthorization(
                  options: authOptions,
                  completionHandler: {_,_ in })
              // For iOS 10 display notification (sent via APNS)
              UNUserNotificationCenter.current().delegate = self
              // For iOS 10 data message (sent via FCM)
              FIRMessaging.messaging().remoteMessageDelegate = self
          } else {
              let settings: UIUserNotificationSettings =
                  UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
              application.registerUserNotificationSettings(settings)
          }
          application.registerForRemoteNotifications()
          // [END register_for_notifications]
          FIRApp.configure()
          // Add observer for InstanceID token refresh callback.
          NotificationCenter.default.addObserver(self,
                                                 selector: #selector(self.tokenRefreshNotification),
                                                 name: .firInstanceIDTokenRefresh,
                                                 object: nil)
          return true
      }
  
  
      
  </code></pre>