在iOS中使用Facebook SDK获取更多个人资料照片 [英] Fetching more profile photos using Facebook SDK in iOS

查看:78
本文介绍了在iOS中使用Facebook SDK获取更多个人资料照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用iOS版facebook SDK.

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) {

         }

         }];
      }

如何获取用户的个人资料照片? 我也想获取他之前的4张个人资料照片. 就像在应用程序Tinder中一样.

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

如何执行此操作?

推荐答案

好的.我发现了

我们将使用以下网址获取所有专辑

We will get all albums with the below url

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

然后我们可以将相册ID传递到以下网址

Then we can pass album ID to below url

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

我们将获得所有个人资料图片... bingo :) :);)

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

这篇关于在iOS中使用Facebook SDK获取更多个人资料照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆