ios facebook login sdk 4.28.0 error code 3

我的未来我决定 提交于 2019-12-22 04:41:44

问题


Error Domain=com.facebook.sdk.core Code=3 "(null)" UserInfo={com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Unknown error building URL.}

The login code is as follows

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

    [login
     logInWithReadPermissions: @[@"public_profile"]
     fromViewController:self
     handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
         NSLog(@"facebook login result.grantedPermissions = %@,error = %@",result.grantedPermissions,error);
         if (error) {
             NSLog(@"Process error");
         } else if (result.isCancelled) {
             NSLog(@"Cancelled");
         } else {
             NSLog(@"Logged in");
         }
     }];

回答1:


Encountered the same error today, after upgrading to version 4.39.0. Downgrading to 4.38.0 resolved it.




回答2:


I had the same issue after migration from ver. 4.38.1 to 4.39.0.

The reason is In FBSDKInternalUtility.m +(NSURL *)URLWithScheme:host:path:queryParameters:error: method is trying to create NSURL from string which is containing "{", "}" symbols.

This is happening because FBSDKUtility.m +(NSString *) URLEncode: method was changed. To fix it it is enough to add "{", "}" symbols to argument string:

NSCharacterSet *urlAllowedSet = [NSCharacterSet
                                   characterSetWithCharactersInString:@" !*();:'@&=+$,/?%#[]\"{}"].invertedSet;

I'm not sure this will not break another functionality. So it's better to just use previous version of SDK.




回答3:


If you downgrade to FBSDKCoreKit & FBSDKLoginKit to 4.38.0 and still get this error make sure you clean your build.

Open your workspace
Command + Option + Shift + K

Mine works with the following pod versions. I will test with 4.38 and 0.5 and update.

pod 'FBSDKCoreKit', '4.36.0' pod 'FBSDKLoginKit', '4.36.0' pod 'FacebookCore', '0.4' pod 'FacebookLogin', '0.4'




回答4:


It's a kind of bug in latest '4.39.0', you just need to lower one version, i.e., '4.38.1'. 'pod' file will look like below:

pod 'FBSDKLoginKit', '4.38.1'
pod 'FBSDKCoreKit', '4.38.1'

Once you install the 'pod', make sure you clean the project.

Update:

In case, if you are not using the pods then you can download the old frameworks from https://developers.facebook.com/docs/ios/downloads and just drag and drop in the project.




回答5:


For those who using FirebaseUI - solution is similar. Put extra lines in Podfile:

pod 'FBSDKLoginKit', '4.38.1'
pod 'FBSDKCoreKit', '4.38.1'

This will force downloading older libraries instead of new ones




回答6:


Did you implement this method in your AppDelegate?

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                          openURL:url
                                                sourceApplication:sourceApplication
                                                       annotation:annotation];
}


来源:https://stackoverflow.com/questions/49124804/ios-facebook-login-sdk-4-28-0-error-code-3

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