【问题标题】:(facebook sdk) com.facebook.sdk.core error 8(facebook sdk) com.facebook.sdk.core 错误 8
【发布时间】:2018-08-30 01:07:20
【问题描述】:

我正在使用 FBSDKLoginButton 登录 FB SDK(这是我创建它的方式):

    loginButton = [[FBSDKLoginButton alloc] init];
    loginButton.readPermissions = @[@"public_profile", @"email", @"user_friends"];
    loginButton.delegate = self;
    loginButton.alpha = 0;
    loginButton.center = CGPointMake(-100, -100);
    [self.view addSubview:loginButton];

然后我有一个这样的委托方法,但是它一直返回错误

操作无法完成。 (com.facebook.sdk.core 错误 8。)

这段代码有什么问题会导致返回错误 8 吗?当我按照他们的官方教程进行操作时,我的 info.plist 中的所有内容似乎都正确无误,并且验证良好。

- (void)loginButton:(FBSDKLoginButton *)loginButton
didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result
              error:(NSError *)error {
    //User is authenticated now
    NSLog(@"fb authenticated");

    //Do strict locations first
    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
    [parameters setValue:@"country,country_code,location" forKey:@"fields"];
    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                  initWithGraphPath:@"me/locations"
                                  parameters:parameters
                                  HTTPMethod:@"GET"];
    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        if (!error) {
            NSDictionary *userData = (NSDictionary *)result;
            NSString *countryName = userData[@"location"][@"country"];
            NSString *countryCode = userData[@"location"][@"country_code"];
            NSLog(@"countryName: %@ countryCode: %@", countryName, countryCode);
        } else {
            NSLog(@"error1: %@", [error localizedDescription]);
        }
    }];
}

【问题讨论】:

    标签: ios facebook facebook-graph-api error-handling


    【解决方案1】:

    确保您的权限输入正确。

    您是否从此处下载了 Facebook iOS SDK:http://github.com/facebook/facebook-ios-sdk。它包含从 iOS 连接到 Facebook 所需的所有内容,以及有关如何使用旧 API 和新 Graph API 的示例代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-12
      • 2016-05-16
      • 2013-04-05
      • 2014-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多