Why is the FBLogin not working in simulator ? - It stays in Safari?
<p>I am using xcode 7.3.And the latest version of fb sdk.I did all method declaration as per the Fb Documentation.But now when i press login with facebook button.It redirect to safari page and its asking whether you want to allow.I gave Yes.After that it still in safari page.And here is one "Done "Button at top left corner of safari page know.If i press that done button only its going in to my home screen.I dont know why?</p>

<p>I tries resetting my simulator, And adding all needed thing in info.plist.But its not working.I am having fb, google plus both login button.But this fb is not working.</p>

<p>Any solution would be great</p>

<p><a href="https://i.stack.imgur.com/3abpu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3abpu.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/HduZL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HduZL.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/A7Nf1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A7Nf1.png" alt="enter image description here"></a></p>

<p>Here after i press the done button only its allowing me to go inside the app.( home screen ).</p>

<p><strong>My code in appdelegate :</strong></p>

<pre><code> func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool {
  return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
    }


    func application(app: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -&gt; Bool {

       // let GoogleHandler = GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation)

        let FacebookHandler = FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: sourceApplication, annotation: annotation)

        return  FacebookHandler
    }
</code></pre>

<p>My code in viewcontroller :</p>

<pre><code>import UIKit
import FBSDKCoreKit
import FBSDKLoginKit

class LoginViewController: UIViewController, UIAlertViewDelegate,  FBSDKLoginButtonDelegate
{
 override func viewDidLoad()
    {
        super.viewDidLoad()

        self.navigationController?.navigationBar.barTintColor = UIColor.redColor()

        self.navigationController?.navigationBar.tintColor = UIColor.whiteColor()

        if (FBSDKAccessToken.currentAccessToken() != nil)
        {
            // User is already logged in, do work such as go to next view controller.
            print("User Already Logged In")
        }
        else
        {
            print("User Not Logged In")
        }

        fbLoginBtn.readPermissions = ["public_profile", "email", "user_friends"]
        fbLoginBtn.center = self.view.center
        fbLoginBtn.delegate = self
        self.view.addSubview(fbLoginBtn)
}

    ////// ------- Fb login delegate methods ------ //////

    func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!)
    {
        if error == nil
        {
            print("Login complete.")
            dispatch_async(dispatch_get_main_queue())
            {
                let appdelegate:AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate

                _ = appdelegate.window!.rootViewController


                let mainStoryBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

                let mainViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("HomeViewController") as! HomeViewController

                let leftViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("MenuViewController") as! MenuViewController


                let leftSideNav = UINavigationController(rootViewController: leftViewController)

                let centerNav = UINavigationController(rootViewController: mainViewController)


                let centerContainer:MMDrawerController = MMDrawerController(centerViewController: centerNav, leftDrawerViewController: leftSideNav)



                centerContainer.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView;

                centerContainer.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView;

                               appdelegate.centerContainer = centerContainer

                appdelegate.window!.rootViewController = appdelegate.centerContainer

                appdelegate.window!.makeKeyAndVisible()
            }

        }
        else
        {
            print(error.localizedDescription)
        }
    }
    func loginButtonDidLogOut(loginButton: FBSDKLoginButton!)
    {
        print("User logged out...")
    }
</code></pre>