Facebook login is failing sometimes in iOS SDK 4.38.0

梦想的初衷 提交于 2020-01-02 23:01:21

问题


Everything was working fine before. Now I changed few things:

  1. updated to Xcode 10.0 (10A255)
  2. updated to Facebook iOS SDK 4.38.0

Now what is happening, sometimes login is getting failed. It is happening on both iOS 12 Device and Simulator. Before I didn't see this issue.

My login code is below:

    if (![FBSDKAccessToken currentAccessToken])
        {            
            FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
            [loginManager logInWithReadPermissions:@[@"email"]
                                fromViewController:self
                                           handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { 

           if (error) {
               // show the error: **sometimes I get in this block**
           } else {
             if ([[FBSDKAccessToken currentAccessToken].permissions containsObject:@"email"])
              {
                // get user basic information like name and picture
              }
}

The same code works sometimes and sometimes not.

You can try to reproduce this by uninstalling the app or by login/logout/login.

Have anyone faced this issue with latest SDK 4.38 / Xcode 10?

I am getting this error:

Error Domain=com.facebook.sdk.login Code=308 "(null)"

For other developers I also wanted to add 3 things which were not working in my case:

  1. enabling keychain from capabilities
  2. making FBSDKLoginManager instance as nil after logout
  3. creating the singleton for FBSDKLoginManager

回答1:


I am using Facebook 4.36, now I am seeing this warning "Your Facebook SDK is out of date. We recommend upgrading to the latest Version 4.37.0, to ensure your app's performance is not affected and to take advantage of our newest features!"

From the following url I downloaded 4.40.0, still I am getting same warning.

https://developers.facebook.com/docs/ios/downloads/

4.44.0 is broken.

If I download 5.x.x from GitHub then I noticed .framework files are not there like FBSDKSharekit.frameworkd, Bolts.framework.

If anyone switched from 4.x.x to 5.x.x please let me know (not using pod)



来源:https://stackoverflow.com/questions/52983796/facebook-login-is-failing-sometimes-in-ios-sdk-4-38-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!