如何使用iOS SDK获取Facebook页面封面照片,
从解析的json结果中,我得到以下结果,但无法从那里得到封面照片。
{
actions = (
{
link = "https://www.facebook.com/100007281559316/posts/1487360021516702";
name = Comment;
},
{
link = "https://www.facebook.com/100007281559316/posts/1487360021516702";
name = Like;
}
);
"created_time" = "2014-10-10T04:09:22+0000";
description = "Loneliness is a good feeling when it is created by Ourself. But . .it is the worst feeling when it is Gifted by others.\nExpecting your Opinion [email protected]";
from = {
id = 100007281543425252416;
name = "Hari Krishna";
};
icon = "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif";
id = "100007281559316_1487360021516702";
link = "https://www.facebook.com/Ekantatha";
message = "https://www.facebook.com/Ekantatha";
name = "\U0d0f\U0d15\U0d3e\U0d28\U0d4d\U0d24\U0d24";
picture = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/v/t1.0-1/c6.0.200.200/p200x200/1779801_631456453593885_482158404_n.jpg?oh=8f766377fc71b8e3703e330067a70ebc&oe=54C1FF93&__gda__=1421213700_5f4ec6aea535e630c1a5a1eace45f34b";
privacy = {
allow = "";
deny = "";
description = "Only Me";
friends = "";
networks = "";
value = SELF;
};
properties = (
{
name = Community;
text = "1,102 like this";
}
);
"status_type" = "shared_story";
type = link;
"updated_time" = "2014-10-10T04:09:22+0000";
}
编辑:
我想这样显示我的单元格,所以我需要封面照片。从json结果我没有得到页面ID。如何使用iOS SDK获取页面的封面照片?
最佳答案
这是更新的解决方案。
var basicUserData = ["fields": "cover,picture,id,birthday,email"]
FBRequestConnection.startWithGraphPath("/me",
parameters: basicUserData,
HTTPMethod: "GET") {
(connection:FBRequestConnection!, result, error) -> Void in
if error != nil {
print(error!)
} else {
print(result!)
}
}
解析团队建议通过访问https://graph.facebook.com/(facebookId)/picture?type=large获取FB个人资料图片,确保将其替换为用户的Facebook ID。 Here is the discussion
笔记:
FacebookSDK v2之后不建议使用用户名字段
“ / me”是正确的端点,而不是“ me”
This gist shows many other interactions with the Facebook Graph