xcode Facebook 个人资料图片大
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10882835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Facebook Profile Picture Large
提问by newton_guima
I am having trouble trying to request the large version of the users profile picture on Facebook.. in my graph path I'm doing:
我在尝试在 Facebook 上请求大版本的用户个人资料图片时遇到问题.. 在我正在做的图形路径中:
NSString *requestPath = @"me/?fields=first_name,last_name,gender,email,birthday,verified,picture";
The picture field in there only gives me the small version of the profile picture, but i need the large and the normal version.. i already tried changing picture to picture_large, pic_large, image_large but none of this works..
那里的图片字段只给我个人资料图片的小版本,但我需要大版本和普通版本。
Please, i already read the documentations, so don't bother answering if you plan on telling me to read it again.. I'm asking this here because i already searched everywhere and couldn't find a solution.
拜托,我已经阅读了文档,所以如果您打算让我再次阅读它,请不要费心回答.. 我在这里问这个是因为我已经到处搜索,但找不到解决方案。
Thanks, Newton
谢谢,牛顿
回答by Murat ?gat
The short answer you are looking for is picture.type(large)
您正在寻找的简短答案是 picture.type(large)
I was looking for the same thing and found the answer using Facebook Graph API explorer found here.
我一直在寻找同样的东西,并使用 Facebook Graph API explorer found here找到了答案。
Now if I use the following code:
现在,如果我使用以下代码:
[FBRequestConnection startWithGraphPath:@"me"
parameters:[NSDictionary dictionaryWithObject:@"picture.type(large),id,email,name,username"
forKey:@"fields"]
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error){[self fbRequestCompleted:result];}];
the "picture" key in the "result" dictionary has the value of the large picture's URL.
“结果”字典中的“图片”键具有大图片的 URL 值。
回答by Nitzan Tomer
You can just use:
你可以只使用:
http://graph.facebook.com/USER/picture?type=large
Where USERcan be either the user id or the user name.
其中USER可以是用户 ID 或用户名。
That returns a redirect to the static image url, as written in the User object documentation:
这会返回到静态图像 url 的重定向,如用户对象文档中所述:
HTTP 302 redirect to URL of the user's profile picture (use ?type=square | small | normal | large to request a different photo).
HTTP 302 重定向到用户个人资料图片的 URL(使用 ?type=square | small | normal | large 请求不同的照片)。
回答by palpoms
Nitzan Tomer's response is still correct for iOS; if you want to get the large version of the user's profile picture using Facebook's iOS API, you can just write:
Nitzan Tomer 的回答对于 iOS 仍然是正确的;如果你想使用 Facebook 的 iOS API 获取用户头像的大版本,你可以这样写:
[facebook requestWithGraphPath:@"me/picture" andParams:[NSMutableDictionary dictionaryWithObject:@"large" forKey:@"type"] andDelegate:self];
And you will get the image data in the resultobject, in this delegate method:
您将在此委托方法中获得结果对象中的图像数据:
- (void)request:(FBRequest*)request didLoad:(id)result