我希望能够从我的多查询结果中提取数据。
我正在使用此代码进行多查询:
NSString *query =
@"{"
@"'friends':'SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25',"
@"'friendinfo':'SELECT uid, name, pic_square FROM user WHERE uid IN (SELECT uid2 FROM #friends)',"
@"}";
NSDictionary *queryParam = @{ @"q": query };
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:queryParam
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"Result: %@", result);
}
}];
然后我将结果打印到命令行,我看到了所有我想看到的数据。
Result: {
data = (
{
"fql_result_set" = (
{
uid2 = 12345;
},
{
uid2 = 12345;
}
);
name = friends;
},
{
"fql_result_set" = (
{
name = "gg";
"pic_big" = "https://fbcdn-profile-a.akamaihd.net/gg";
sex = gg;
uid = 12345;
},
{
name = "gg";
"pic_big" = "https://fbcdn-profile-a.akamaihd.net/gg";
sex = gg;
uid = 12345;
},
{
name = "gg";
"pic_big" = "https://fbcdn-profile-a.akamaihd.net/gg";
sex = gg;
uid = 12345;
}
);
name = friendinfo;
}
);
}
我只是不知道如何从结果中的每个条目中提取名称、图片 url、性别和 uid。我觉得我需要使用数组和字典的某种组合,但我不确定如何。提前感谢您的帮助。:)