我需要用TableView
显示其他参与者的姓名和图像,就像Facebook收件箱一样。
我正在使用此fql查询来获取收件人。
- (void)readInbox {
NSString *query =
[NSString stringWithFormat:@"SELECT recipients,thread_id FROM unified_message where thread_id IN (SELECT thread_id FROM unified_thread WHERE folder = 'inbox')"];
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
query, @"q",
nil];
FBRequest *request = [FBRequest requestWithGraphPath:@"/fql"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSLog(@"Result: %@", result);
}];
}
结果是这样的
data = ({
recipients = ({
email = "****@facebook.com";
name = "*****";
"user_id" = 6 * * * ;
}, {
email = "****@facebook.com";
name = "******"; //This is me
"user_id" = * * * ;
});
"thread_id" = "t_mid.1371470061934:11b440f1722f8fc977";
},
这对我想显示的内容正确吗?如何使用fql吸引所有其他参与者(我除外)?
最佳答案
您将使用FQL查询接收JSON
数据。解析它并将其存储在Mutable Array
中。
您可以使用以下查询从用户的邮箱中获取其name
和id
。SELECT name, uid FROM user WHERE uid IN (SELECT author_id FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0))
现在,第一个索引将是您。如果需要,将其从阵列中删除。
关于ios - Fql的Facebook收件箱,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23212032/