title: Facebook login not working in swift
body: <p>Im trying to implement Facebook login in my app but when I try to login it goes to Facebook app and comes back to my game but the login button doesn't become log out and if I try to get any information such as access token, granted permissions or declined permissions it is nil. this is the code I have: </p>
  
  <pre><code>import Foundation
  class IntroScene: SKScene, FBSDKLoginButtonDelegate {
  let loginButton: FBSDKLoginButton = {
      let button = FBSDKLoginButton()
      button.readPermissions = ["email"]
      return button
  }()
  
  override func didMove(to view: SKView) {
      self.backgroundColor = UIColor.black
  
      view.addSubview(loginButton)
      loginButton.center = (self.view?.center)!
      loginButton.delegate = self
  }
  
  func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) {
  
  }
  
  func loginButtonWillLogin(loginButton: FBSDKLoginButton!) -&gt; Bool {
      return true
  }
  
  func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
      if(error == nil)
      {
          print("login complete")
          //print(FBSDKAccessToken.current()) -&gt; crashes because its nil
          //print(result.grantedPermissions) -&gt; crashes its nil
      }
      else{
          print(error.localizedDescription)
      }
  }
  }
  </code></pre>
  
  <p>my info.plist looks like following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
      &lt;key&gt;UIViewControllerBasedStatusBarAppearance&lt;/key&gt;
      &lt;false/&gt;
      &lt;key&gt;LSApplicationQueriesSchemes&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;fbapi&lt;/string&gt;
          &lt;string&gt;fb-messenger-api&lt;/string&gt;
          &lt;string&gt;fbauth2&lt;/string&gt;
          &lt;string&gt;fbshareextension&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
      &lt;dict&gt;
          &lt;key&gt;NSExceptionDomains&lt;/key&gt;
          &lt;dict&gt;
              &lt;key&gt;facebook.com&lt;/key&gt;
              &lt;dict&gt;
                  &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
                  &lt;true/&gt;
                  &lt;key&gt;NSThirdPartyExceptionRequiresForwardSecrecy&lt;/key&gt;
                  &lt;false/&gt;
              &lt;/dict&gt;
              &lt;key&gt;fbcdn.net&lt;/key&gt;
              &lt;dict&gt;
                  &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
                  &lt;true/&gt;
                  &lt;key&gt;NSThirdPartyExceptionRequiresForwardSecrecy&lt;/key&gt;
                  &lt;false/&gt;
              &lt;/dict&gt;
              &lt;key&gt;akamaihd.net&lt;/key&gt;
              &lt;dict&gt;
                  &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
                  &lt;true/&gt;
                  &lt;key&gt;NSThirdPartyExceptionRequiresForwardSecrecy&lt;/key&gt;
                  &lt;false/&gt;
              &lt;/dict&gt;
          &lt;/dict&gt;
      &lt;/dict&gt;
      &lt;key&gt;CFBundleURLTypes&lt;/key&gt;
      &lt;array&gt;
          &lt;dict&gt;
              &lt;key&gt;CFBundleURLSchemes&lt;/key&gt;
              &lt;array&gt;
              &lt;string&gt;//fbmyid&lt;/string&gt;
          &lt;/array&gt;
      &lt;/dict&gt;
  &lt;/array&gt;
  &lt;key&gt;FacebookAppID&lt;/key&gt;
  &lt;string&gt;//myid&lt;/string&gt;
  &lt;key&gt;FacebookDisplayName&lt;/key&gt;
  &lt;string&gt;Crazy Traffic Saga&lt;/string&gt;
  &lt;key&gt;CFBundleDevelopmentRegion&lt;/key&gt;
  &lt;string&gt;en&lt;/string&gt;
  &lt;key&gt;CFBundleExecutable&lt;/key&gt;
  &lt;string&gt;$(EXECUTABLE_NAME)&lt;/string&gt;
  &lt;key&gt;CFBundleIdentifier&lt;/key&gt;
  &lt;string&gt;$(PRODUCT_BUNDLE_IDENTIFIER)&lt;/string&gt;
  &lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt;
  &lt;string&gt;6.0&lt;/string&gt;
  &lt;key&gt;CFBundleName&lt;/key&gt;
  &lt;string&gt;$(PRODUCT_NAME)&lt;/string&gt;
  &lt;key&gt;CFBundlePackageType&lt;/key&gt;
  &lt;string&gt;APPL&lt;/string&gt;
  &lt;key&gt;CFBundleShortVersionString&lt;/key&gt;
  &lt;string&gt;1.0&lt;/string&gt;
  &lt;key&gt;CFBundleSignature&lt;/key&gt;
  &lt;string&gt;????&lt;/string&gt;
  &lt;key&gt;CFBundleVersion&lt;/key&gt;
  &lt;string&gt;1&lt;/string&gt;
  &lt;key&gt;LSRequiresIPhoneOS&lt;/key&gt;
  &lt;true/&gt;
  &lt;key&gt;UILaunchStoryboardName&lt;/key&gt;
  &lt;string&gt;LaunchScreen&lt;/string&gt;
  &lt;key&gt;UIMainStoryboardFile&lt;/key&gt;
  &lt;string&gt;Main&lt;/string&gt;
  &lt;key&gt;UIRequiredDeviceCapabilities&lt;/key&gt;
  &lt;array&gt;
      &lt;string&gt;armv7&lt;/string&gt;
  &lt;/array&gt;
  &lt;key&gt;UISupportedInterfaceOrientations&lt;/key&gt;
  &lt;array&gt;
      &lt;string&gt;UIInterfaceOrientationPortrait&lt;/string&gt;
      &lt;string&gt;UIInterfaceOrientationLandscapeLeft&lt;/string&gt;
      &lt;string&gt;UIInterfaceOrientationLandscapeRight&lt;/string&gt;
  &lt;/array&gt;
  &lt;key&gt;UISupportedInterfaceOrientations~ipad&lt;/key&gt;
  &lt;array&gt;
      &lt;string&gt;UIInterfaceOrientationPortrait&lt;/string&gt;
      &lt;string&gt;UIInterfaceOrientationPortraitUpsideDown&lt;/string&gt;
      &lt;string&gt;UIInterfaceOrientationLandscapeLeft&lt;/string&gt;
      &lt;string&gt;UIInterfaceOrientationLandscapeRight&lt;/string&gt;
  &lt;/array&gt;
  </code></pre>
  
  <p>
  </p>