Search code examples
iphonefacebookfacebook-fqlfeed

Match names of pages with posts in Facebook FQL


I am rewriting parts of my iPhone application to use FQL instead of Graph requests. I am using a multiquery to retrieve the news feed aswell as the name of the users who posted something. This works well, except for pages. The request bellow does not get the name of a page.

NSString *queryUserStream = @"SELECT post_id, actor_id, attachment, permalink, tagged_ids, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0";
NSString *queryActorInfo = @"SELECT uid, name, pic_small FROM user WHERE uid IN (SELECT actor_id FROM #user_stream)";
NSString *queries = [NSString stringWithFormat:@"{\"user_stream\":\"%@\",\"actor_info\":\"%@\"}", queryUserStream, queryActorInfo];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:queries, @"queries", nil];

As I am doing it now it's easy as I will get two arrays in which the indexes matches. E.g. index 5 in the actor_info array will hold the name of the post on index 5 in the user_stream array.

Can anyone tell me how to add the names of pages and match them with the post?


Solution

  • To solve this, I made an extra query for the names of profiles. When all the queries where finished, I looped through the user_stream and matched the actor_id with either a uid in the query for user info or in the query for page info.