简体   繁体   中英

Getting a larger Facebook profile picture and personal data at a time

Please help getting a larger profile picture from Facebook. My method below returns a link to a tiny one.

- (void)openSession{

    NSArray *permissions = [NSArray arrayWithObject:@"email"];
    NSDictionary *parameters = [NSDictionary dictionaryWithObject:
                                @"picture,email,name,username,location,first_name,last_name"
                                                           forKey:@"fields"];
    [FBSession openActiveSessionWithReadPermissions:permissions
                                       allowLoginUI:YES
                                  completionHandler:^(FBSession *session,
                                                      FBSessionState state,
                                                      NSError *error) {
                                      if (session.isOpen) {
                                          [FBRequestConnection startWithGraphPath:@"me" parameters:parameters
                                                                       HTTPMethod:@"GET"
                                                                completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

                                                                    //save personal details using "id result"
                                                                    [...saving method here...]
                                                                    //manage session
                                                                    [self sessionStateChanged:session state:state error:error];
                                                                }];
                                      }
                                  }];
}

I have also found this way: if following this link in a web browser, I can get the image larger (the bla-bla-bla is my Facebook id:)))

http://graph.facebook.com/92875029-bla-bla-bla-84538042/picture?type=large

But it looks like the link above leads to a redirect page, cos' after the image is loaded, the link is changed to :

http://profile.ak.fbcdn.net/hprofile-ak-snc6/1864-bla-bla-bbla-bla482_n.jpg

Well, never mind, I cannot use it in my method above anyway.

So actually I am getting the profile picture, but as I said, it's small.

Please help getting it larger, but within my used method. Many thanks in advance

将您的参数更改为:

@"picture.type(large),email,name,username,location,first_name,last_name"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM