title: FireBase iOS Messaging, fails to fetch APNS Token
body: <p>Ok, I have spent half of yesterday and half of this morning searching the boards and Google, and Firebase Docs for the solution.  Just to be clear.</p>
  
  <p>I have FirebaseAppDelegateProxyEnabled set to NO in my info.plist, i'll post my appDelegate methods, but I have looked through the docs many times:</p>
  
  <p>didFinishLaunchingWithOptions:</p>
  
  <pre><code>    customizeAppearance()
      FIRApp.configure()
  
      tracker.appLaunch()
  
      registerForPushNotifications(application)
      notificationCenter.addObserver(self, selector: #selector(AppDelegate.tokenRefreshNotification), name: kFIRInstanceIDTokenRefreshNotification, object: nil)
  
      return PersistentStoreManager.sharedInstance.managedObjectContextHasBeenInitialized()
  </code></pre>
  
  <p>didReceiveRemoteNotification:</p>
  
  <pre><code>    //Full message
      print("%@", userInfo)
  
  
      articleID = "\(userInfo["articleId"]!)"
      notificationCenter.postNotificationName("newArticle", object: nil)
  </code></pre>
  
  <p>registerForPushNotifications:</p>
  
  <pre><code>    let notificationSettings = UIUserNotificationSettings(
          forTypes: [.Badge, .Sound, .Alert], categories: nil)
      application.registerUserNotificationSettings(notificationSettings)
      application.registerForRemoteNotifications()
  </code></pre>
  
  <p>didRegisterForRemoteNotificationsWithDeviceToken:</p>
  
  <pre><code>//send the APNs token to firebase
      FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.Sandbox)
      print("In did register For remote Not with token: \(FIRInstanceID.instanceID().token())")
  }
  </code></pre>
  
  <p>tokenRefreshNotification:</p>
  
  <pre><code>    let refreshedToken = FIRInstanceID.instanceID().token()!
      //send token information to server
      self.manager.sendNotificationToken(refreshedToken)
  
      //double check to connect to FCM, may have failed when attempted before having a token
      connectToFcm()
  
  func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
      print("Failed to register:", error.description)
  }
  </code></pre>
  
  <p>Console Log:</p>
  
  <pre><code>WARNING: Firebase Analytics App Delegate Proxy is disabled. To log deep link campaigns manually, call the methods in FIRAnalytics+AppDelegate.h.
  Configuring the default app.
  &lt;FIRAnalytics/INFO&gt; Firebase Analytics v.3201000 started
  &lt;FIRAnalytics/INFO&gt; To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
  &lt;FIRInstanceID/WARNING&gt; Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "The operation couldn’t be completed. (com.firebase.iid error 1001.)"
  &lt;FIRMessaging/INFO&gt; FIRMessaging library version 1.1.0
  [4459:501] &lt;FIRAnalytics/INFO&gt; Firebase Analytics enabled
   CFNetwork SSLHandshake failed (-9806)
  2016-07-28 10:26:08.245: &lt;FIRInstanceID/WARNING&gt; APNS Environment in profile: development
  In did register For remote Not with token: Optional("fWmrxcdNICg:APA91bF_pVwLixBXFuRZEF0w64J7zizSQfpaYNjJhf9g95fZxDmqKD-I1gnaxufkmbNvGZZKs8ifL6ZlXY9nWBc0utgVjEBJG7tUNnA8ciOzeyW9wtfSHyq0IYIf4OepJ4qTJf8qLpIR")
  In did register For remote Not with token: Optional("fWmrxcdNICg:APA91bF_pVwLixBXFuRZEF0w64J7zizSQfpaYNjJhf9g95fZxDmqKD-I1gnaxufkmbNvGZZKs8ifL6ZlXY9nWBc0utgVjEBJG7tUNnA8ciOzeyW9wtfSHyq0IYIf4OepJ4qTJf8qLpIR")
  </code></pre>
  
  <p>And I am targeting iOS 8.3 and up.  I have both my development and prod push notification certs uploaded into Firebase as well.</p>
  
  <p>I have breakpoints set, my tokenRefreshNotification() doesn't get called and neither does didReceiveRemoteNotification()</p>
  
  <p>I don't know what is going wrong, and I am suppose to send the application to the app store Monday.  I was getting notifications fine most of the day yesterday, and then they stopped.  I don't get them from the Firebase console or from our web service servers.</p>