title: How to get FBSDKAccessToken in IOS Swift
body: <p>I am using Facebook SDK in IOS9 with swift but I am not getting the aceestoken. I have written the login code in <strong>viewcontroller.swift</strong>  file. I have done all settings is in my <strong>info.plist</strong> file also, but always getting nil value in accesstoken. </p>
  
  <p>Here is my code    </p>
  
  <p><strong>AppDelegate.swift</strong></p>
  
  <pre><code>@UIApplicationMain
  class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool {
  
      FBSDKLoginButton.classForCoder()
      return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
  
     }
    func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -&gt; Bool {
     return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
     }
  }
  </code></pre>
  
  <p><strong>ViewController.swift</strong></p>
  
  <pre><code>class ViewController: UIViewController,FBSDKLoginButtonDelegate {
  
  
   override func viewDidLoad() {
            super.viewDidLoad()
             //outlet for fbsdkloginbutton
              @IBOutlet weak var facebookLoginButton: FBSDKLoginButton!
           var error:NSError?
  
                  //check for error
                   if error != nil{
                                      print(error)
                                      return
                                  }
                      //Check for the access token
                                  if (FBSDKAccessToken.currentAccessToken() == nil){
                                      print("USER NOT LOGGED IN")
                                  }else{
                                      print("USER LOGGED IN")
                                  }
                  //set delegate for button
                          self.facebookLoginButton.delegate = self
                                  //read permission
                                  facebookLoginButton.readPermissions = ["public_profile","user_friends","email"]
                               }
                          func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
                                  /*
                                   Check for successful login and act accordingly.
                                   Perform your segue to another UIViewController here.
                                   */
                           if (error != nil){
                                      print(error.localizedDescription)
                                  }
  
                                  if let userToken = result.token{
                                      // GET USER TOKEN HERE
                                      let token:FBSDKAccessToken = userToken
                                      print(token)
                                      //print token id and user id
                                      print("TOKEN IS \(FBSDKAccessToken.currentAccessToken().tokenString)")
                                      print("USER ID IS \(FBSDKAccessToken.currentAccessToken().userID)")
  
                                  }
  
                              }
                              func applicationWillTerminate(application: UIApplication)
                              {
                                  // Called when the application is about to terminate.      Save data if 
                              }
  
  
                              func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) {
                                  // Actions for when the user logged out goes here
                              }
  
                          }
  </code></pre>