我正在尝试使用Facebook iOS SDK使用以下查询获取好友列表详细信息:
if (FBSession.activeSession.isOpen) {
[FBRequestConnection startWithGraphPath:@"me?fields=id,name,friendlists&fields=id,name,members&fields=pic,can_post,id,link,name,pic_crop,pic_large,pic_small,pic_square,profile_type,username,picture,list_type" completionHandler:^(FBRequestConnection *connection,id user, NSError *error) {
}];
我知道错误在于使用'&'在构建查询时,我不知道如何嵌套查询(获取pic,can_post等详细信息)。
有人可以帮忙吗?
答案 0 :(得分:2)
你应该这样做
me?fields=name,about,accounts.fields(about)
如果您想要请求“用户”(包括姓名,关于)和帐户关联(包括“关于”字段)
您必须使用第二个连接。 (点符号)而不是?fields =
答案 1 :(得分:1)
您应该使用+ startForMyFriendsWithCompletionHandler:(FBRequestHandler)handler
:
if (FBSession.activeSession.isOpen) {
[FBRequestConnection startForMyFriendsWithCompletionHandler:^(FBRequestConnection *connection,id user, NSError *error) {
}];
}
请注意,它会从您的朋友那里获取所有字段。如果您只想要几个,则可以startWithGraphPath:completion:
使用@"me/friends?fields=id,name,pic_square
作为图表路径。