我正在尝试根据朋友的性别并根据pic_big!=NULL
(每个朋友应该有一张大型的个人资料图片)来获取用户的朋友(登录到他的FaceBook帐户)。
以下是我写的代码。
NSString *queryString = [NSString stringWithFormat:@"%@%@%@%@%@%@%i%@%@",
@"SELECT name, pic_big, sex, uid FROM user ",
@"WHERE sex=", @"male", @" AND ",
@"pic_big != 'null' AND uid IN (SELECT uid2 ",
@"FROM friend WHERE uid ", loggedInID, @" )",
@"ORDER BY name"];
NSMutableDictionary *dictionary=[NSMutableDictionary
dictionaryWithObjectsAndKeys:queryString,@"query", nil];
[FBRequest getRequestWithParams:dictionary
httpMethod:@"GET"
delegate:self
requestURL:@"fql.query"];
loggedINiD
是用户的登录ID。我没有在委托方法中得到任何回应。我确信我需要重新检查这个SQL查询。请提出任何建议。
答案 0 :(得分:2)
您的FQL代码中有一些错误,并且为了简单起见添加了一个建议,以下是您应该查询的内容:
SELECT name,pic_big,sex,uid FROM user WHERE uid in(SELECT uid2 FROM friend WHERE uid1 = me())AND sex =“male”
注意事项:
答案 1 :(得分:0)
NSString *queryString = [NSString stringWithFormat:@"SELECT name, pic_big, sex, uid FROM user WHERE sex='male' AND pic_big != 'null' AND uid IN (SELECT uid2 FROM friend WHERE uid = %i) ORDER BY name", loggedInID];
使用此queryString。我不确定,但认为这会对你有帮助。