Facebook SDK 3.1 – com.facebook.sdk Error 5 when authenticating with

When authenticating with following authorization method i’m getting com.facebook.sdk error 5 with startWithGraphPath and startForMeWithCompletionHandler but not with requestWithGraphPath. I’m succesfully getting token (printing in didLogin) and getting anything which i want with requestwithGraphPath but i’m unable to get work with other methods. If anybody encountered with same issue or something similar or has any idea, i’d be happy if you share it.


  • Call Facebook delegates in Swift
  • Retrieve Facebook friends list
  • Facebook share content only shares URL in iOS 9
  • How can I do a Facebook login using Swift 2.0 and iOS 9.1?
  • iOS Facebook SDK - Check Permissions
  • omniauth for rails and ios authentication
  • Method:

    NSArray *permissions = [[NSArray alloc] initWithObjects: @"user_likes",@"offline_access",@"read_stream",@"publish_stream",nil];
    [_facebook authorize:permissions];

    2 Solutions Collect From Internet About “Facebook SDK 3.1 – com.facebook.sdk Error 5 when authenticating with”

    The startWithGraphPath and other start* methods are likely not picking up an active session. Those methods are relying on an active session being set. See:


    “The request uses the active session represented by [FBSession activeSession].”

    So you’ll have to do something like this:

    [FBSession setActiveSession:session];

    Where session is an FBSession that you had previously set up.

    Following solution worked for me. But if you’re storing a permanent access token, you need to be sure user not removed application permissions otherwise it will give an error. And you can check that with requestWithGraphPath -> “me/permissions”.

    Application Init Function (e.g.:didFinishLaunchingWithOptions/or where you init your Facebook object which needs to be fbsessiondelegate in the mean time)

    NSArray* permissions = [[NSArray alloc] initWithObjects:@"user_likes",@"offline_access", nil];
            FBSession*oursession = [[FBSession alloc] initWithPermissions:permissions];

    FBDidLogin function:

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
        [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
        [defaults synchronize];

    Example graph api request function:

    NSUserDefaults *userDefaults =[NSUserDefaults standardUserDefaults];
            NSString *key = [userDefaults stringForKey:@"FBAccessTokenKey"];
        FBRequest* ourcon = [[FBRequest alloc] initWithSession:oursession graphPath:@"me/likes" parameters:params HTTPMethod:@"GET"];
                [ourcon startWithCompletionHandler: ^(FBRequestConnection *connection, id<FBGraphUser> result, NSError *error){
                    NSArray* collection = (NSArray*)[result data];
                    NSLog(@"You have %d like", [collection count]);
                    NSDictionary* name = [collection objectAtIndex:14];
                    NSLog(@"Like Name: %@", [name objectForKey:@"name"]);