Search code examples
iosfacebookswiftauthorizationfacebook-ios-sdk

Facebook iOS SDK Login with UIWebView instead of safari (Native trick/solution)


I am trying to utilize login process via Facebook`s iOS SDK, however, the login process is implemented via safari, instead of UIWebView. Is there any native way to fix this behavior? Or at least a simple/elegant solution?

let fbLoginManager = FBSDKLoginManager()
            fbLoginManager.logInWithReadPermissions(["email"], handler: {
                (result: FBSDKLoginManagerLoginResult!, error:NSError!) -> Void in
                if ((error) != nil){
                }
                else if (result.isCancelled){
                } else {
                    if(result.grantedPermissions.contains("email")){
                        print(result)
                    }
                }
            })

Solution

  • You can find some nice solutions here:

    1. Solution 1

    2. Solutions 2

    3. Solutions 3