Facebook login not working iOS 10

Good Day All,


I am having an issue with an app and logging in with Facebook.


My app uses this method:


FBSDKLoginManager logInWithReadPermissions:<#(NSArray *)#> fromViewController:<#(UIViewController *)#> handler:<#^(FBSDKLoginManagerLoginResult *result, NSError *error)handler#>


The web view comes up, shows the app as already authorized, I tap OK the webview reloads but then nothing happens, it stays on a blank page, and the delegate isn't called to process the login.


Does anybody have a workaround for this?


I am already on the latest Facebook iOS SDK, 4.13.1, there are no updates, and I can't find anything online.


Is anyone else having this issue?

Replies

I've been able to successfully login with Facebook by tapping the little Open in Safari icon at the bottom right, and when asked "Are you sure you want to submit this form again?", tapping submit, and then get the confirmation to "Open this page in "App Name"?". When I tap "Open" I get pushed back to my app and it continues as usual.


So perhaps something with URL scheme's not working properly from webviews within an app and iOS 10?

Same for me

callback for this method is never called

fbLoginManager.logIn(withReadPermissions: ["public_profile", "email", "user_friends"], from: self) { (result, error) -> Void in


the following message appears in logs:
-canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

Oh my! I've been having the same issue. I thought I installed the SDK wrong but everything I changed, followed a-z, nothing changed. There is definitely an issue.

I have same issue http://stackoverflow.com/questions/38689631/how-to-use-facebook-ios-sdk-on-ios-10

Some problem in IOS 10 so FBSDK cant use `SecItemUpdate` to update keychain

Was anyone able to resolve this issue?

WIth iOS 10 beta 8 and the latest Facebook SDK it appears this issue has been resolved.

Sounds good. Thanks!

Running Xcode 8 GM with latest FBSDKCoreKit and FBSDKLoginKit and am still seeing this issue. Am really stumped. Tried toggling the Keychain Sharing option as noted in the StackOverflow thread, but no luck.


Should be noted that we are seeing this exact same issue with Google Signin as well.

Curious to know if anyone has been able resolve this issue recently.

This has been resolved for me, perhaps in my tweaking and altering the URL schemes to try make it work I fixed it too.


Here is my current LSApplicationQueriesSchemes key in my Info.plist


<key>LSApplicationQueriesSchemes</key>
<array>
        <string>fbapi</string>
        <string>fbapi20130214</string>
        <string>fbapi20130410</string>
        <string>fbapi20130702</string>
        <string>fbapi20131010</string>
        <string>fbapi20131219</string>
        <string>fbapi20140410</string>
        <string>fbapi20140116</string>
        <string>fbapi20150313</string>
        <string>fbapi20150629</string>
        <string>fbapi20160328</string>
        <string>fbauth</string>
        <string>fbauth2</string>
        <string>fb-messenger-api20140430</string>
        <string>fb-messenger-platform-20150128</string>
        <string>fb-messenger-platform-20150218</string>
        <string>fb-messenger-platform-20150305</string>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
</array>


I pretty much have every facebook query in there from before. I beleive this was the only change I had made since it stopped working with the original beta. Then now with the GM making sure the FBSDK is on the latest version, and with these key values in there, it is working fine again for me.

We Solved it!! Our issue was some third party plugins trying to auto integrate into our app delegate. For us, it was CleverTap (the `autoIntegrate()` function).


Be safe out there.

I got the same issue.


The fix was changing the using viewcontroller:


FBSDKLoginManager logInWithReadPermissions:<#(NSArray *)#> fromViewController:viewcontrollerA

We was presenting the view seperated (without presenting the attached viewcontrollerA) so we have to use the current active viewcontrollerB.

In my situation the completion handler is never called

FBSDKLoginManager logInWithReadPermissions:<#(NSArray *)#> fromViewController:<#(UIViewController *)#> handler:<#^(FBSDKLoginManagerLoginResult *result, NSError *error)handler#>


so in debuging, i put the breakpoint in "FBSDKLoginManager.m" at "logInWithBehavior:(FBSDKLoginBehavior)loginBehavior" and findout that weakSelf getting nil and not be able to call "logInWithBehavior: serverConfiguration: serverConfigurationLoadError:"


- (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior
{
  __weak __typeof__(self) weakSelf = self;
  [FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *loadError) {
    [weakSelf logInWithBehavior:loginBehavior serverConfiguration:serverConfiguration serverConfigurationLoadError:loadError];
  }];
}


Solution:

In my case, I change FBSDKLoginManager variable as property rather than using as function variable. Make sure, FBSDKLoginManager varibale must reamin alive until the completion handler call

@dev.hoha

This solved the issue for me. Thank you very much. BTW: I found the weakSelf being nil myself and googled for "facebook weakSelf logInWithBehavior:" to find this page.

The facebook login documentation is wrong at this time for XCode 8. However the issue is not related to a specific iOS version. It ocures on both iOS 9 and iOS 10 when built with XCode 8.

@cybergen


Thanks for sharing the fixed. But for second time you login came from the logout. Still a Blank page any suggestion how to fix it. Thanks in advance.