Get FB Albums of a User

I am getting an empty array when I ask to login to facebook user photo albums. Below is the code:

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                      initWithGraphPath:[NSString stringWithFormat:@"me/albums"]
                                      parameters:nil
                                      HTTPMethod:@"GET"];
        [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                              id result,
                                              NSError *error) {
            NSLog(@"Results: %@",result);
        }];

      

NSLog results:

Results: {
data =     (
);

      

On login, I set the permissions as @"basic_info",@"user_photos",@"friends_photos"

Here is the login code:

FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
    [loginManager logInWithReadPermissions:@[@"basic_info",@"user_photos",@"friends_photos"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
        [appDelegate getFacebookUserInfo];
        NSLog(@"Granted Perm: %@ Declined Perm: %@",[result grantedPermissions],[result declinedPermissions]);
    }];

      

NSLog prints:

    Granted Perm: {(
    email,
    "contact_email",
    "public_profile"
)} Declined Perm: {(
)}

      

+3


source to share


1 answer


  • @"friends_photos"

    Not required when registering .
  • @"user_photos"

    will allow the work.

According to the official Facebook documentation: If your app asks for this permission, Facebook will have to look at how your app is using it.



This is the reason, it @"me/albums"

returns an empty array. In the meantime, your application is submitted for review on Facebook, you can get the user's album. But the user must be one of the users in the "Roles in the Facebook app bar" section.

+3


source







All Articles