问题
Everything was working fine before. Now I changed few things:
- updated to Xcode 10.0 (10A255)
- 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:
- enabling keychain from capabilities
- making FBSDKLoginManager instance as nil after logout
- 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