0
votes

I am using Facebook SDK latest version 4.3 in my code. My task is that I have to fetch the complete album of user named Profile Pictures from Facebook's following path: UserProfile-> Photos-> Albums-> Profile Pictures.

To achieve this I have passed the permission for @"public_profile", @"user_photos", etc...

I have searched many links on SO & tried almost all the suitable answers suggested by geeks.

I tried things given here, here, and a lot more...

In my current scenario, I am getting Users Profile Picture (Current), but I need all pictures stored in his Profile Pictures Album. If anyone has any idea, please help.

2
The first link in StackOverflow already contains the answer! - Tobi
see my answer may be helped.......stackoverflow.com/questions/30207465/… - Maulik shah

2 Answers

0
votes

There's no way to do this in one request as far as I know. You'll need to do two things:

  1. Request the albums of the user, and parse the results for the album "Profile Pictures"

    GET /me/albums?fields=id,name&locale=en_US

This returns an JSON like this:

{
  "data": [
    {
      "id": "442898331243456464", 
      "name": "Profile Pictures", 
      "created_time": "2010-12-12T13:35:29+0000"
    }
    ...
  ], 
  "paging": {
    "cursors": {
      "after": "NDQyODk4MzMxMjQz", 
      "before": "MTAxNTA5MjQyNDQ4NDYyNDQ="
    }
  }
}
  1. Grab the id of the album with the name "Profile Pictures", and request the photos edge like this:

    GET /442898331243456464/photos

You will receive a JSON obect with the profile pictures. It's possible that you need to paginate through the results if there are more than 25 photos.

0
votes

first login in facebook after that write following code by which you can get user profile pic from facebook .

  NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
            [parameters setValue:@"id,name,email,picture" forKey:@"fields"];

            [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:parameters]
             startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                          id result, NSError *error)
            {
                NSLog(@"Your get the result here contain userid, name, email and picture");
             }];