0

I am using facebook SDK for iOS in my app.

   -(IBAction)FacebookLogin:(id)sender{

  if (FBSession.activeSession.isOpen) {
     [self promptUserWithAccountNameForStatusUpdate];
    } 

   else {
    NSArray *permissions = [[NSArray alloc] initWithObjects: @"publish_stream",@"email",nil];
   [FBSession openActiveSessionWithPermissions:permissions
                                   allowLoginUI:YES
                              completionHandler:^(FBSession *session,
                                                  FBSessionState status,
                                                  NSError *error) {
                                   if (error) {


                                  } else if (FB_ISSESSIONOPENWITHSTATE(status)) {

                                      [[FBRequest requestForMe] startWithCompletionHandler:
                                       ^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
                                           if (!error) {
                                               [self promptUserWithAccountNameForStatusUpdate];

                                           }
                                       }];
                                  }
                              }];
}

}

    -(void)promptUserWithAccountNameForStatusUpdate {

      [[FBRequest requestForMe] startWithCompletionHandler:
 ^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
     if (!error) {

         }

         }];
      }

How can I fetch profile photos of user ? I want to fetch his previous 4 profile photos also. Just like in the app Tinder.

How to do this ?

1 Answers1

0

Ok..I found that

We will get all albums with the below url

   https://graph.facebook.com/[uid]/albums?access_token=[AUTH_TOKEN]

Then we can pass album ID to below url

   https://graph.facebook.com/[ALBUM_ID]/photos?access_token=[AUTH_TOKEN]

We will get all profile images...bingo :) :) ;)