(facebook sdk) com.facebook.sdk.core error 8

I am logging into the FB SDK using a FBSDKLoginButton (this is how I create it):

    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];

Then I have a delegate method like this, however it keeps returning the error

The operation couldn’t be completed. (com.facebook.sdk.core error 8.)

Is there anything wrong with this code that would be causing this to be returning error 8? Everything in my info.plist appears to correct as I followed their official tutorial and it authenticates fine.

- (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]);
        }
    }];
}

1 answer

  • answered 2018-03-21 05:11 Mr.Javed Multani

    Make sure your permissions are typed correctly.

    Have you downloaded the Facebook iOS SDK from here: http://github.com/facebook/facebook-ios-sdk. It contains all you need to connect to Facebook from iOS and also sample code on how to use both the old API and the new Graph API.