0

I am working on App in which I have added FBSDKLoginKit to allow user login using Facebook. After entering facebook user id and password, I see below page. enter image description here

Now, I press ok button, I am seeing blank page.

enter image description here

As expected, I should not see blank page. So I press Done button at upper left corner, program call function handleImplicitCancelOfLogIn from SDK and I see login's not successful and the its routed to app's login home page.

I don't see any error while debugging, but when I press Done button I see flag result.isCancelled is set to true (because done button tap calls function handleImplicitCancelOfLogIn)

   FBSDKLoginManager().logInWithReadPermissions(["public_profile"], fromViewController: hostViewController) { (result, error) in
        if error != nil || result.isCancelled {
            completion(error: error ?? NSError(domain: "Facebook Login Failed", code: -1, userInfo: nil))
        }

In above call, I see error equal to nil but result.isCancelled is set to true.

I checked other thread listed below similar to this, and I am sure that all calls related to Facebook are their and working fine.

  1. Facebook FBSDKLoginManager/logInWithReadPermissions Swift Example not using Parse
  2. Facebook login fails (always isCancelled) after upgrading to SDK 4.1

This is happening for iOS 8 and 9 as well and this was working when developed first time.

Current API version “4.12.0", Xcode version - Version 7.3 (7D175), iOS 8.0 and 9.0 If I use iOS 8, I see weird response on Safari webpage.

Any clue/hint will be greatly appreciated. Let me know if you need to know anything further.

Community
  • 1
  • 1
Naren
  • 1,504
  • 16
  • 19
  • While debugging I am seeing that I get no error but value of FBSDKAccessToken.currentAccessToken() is nil – Naren Oct 04 '16 at 01:38

1 Answers1

3

You need to implement the callback method in AppDelegate. UIApplicationDelegate's application:openURL:options: for iOS 9.0 and above. application:openURL:sourceApplication:annotation: for iOS 8.0.

The question is already answered here: Facebook SDK login never calls back my application on iOS 9

Community
  • 1
  • 1
ramacode
  • 914
  • 6
  • 14