iOS Facebook Connect news feed
I need to get the user news feed data.
Currently I'm using this:
[[FBManager defaultManager]getFBRequestWithGraphPath:@"me/home" params: andDelegate:self];
and then:
开发者_运维问答- (void)request:(FBRequest *)request didLoad:(id)result {
if ([result isKindOfClass:[NSArray class]])
result = [result objectAtIndex:0];}
result gives me a bunch of data. But how do Extract these individually? Maybe the name and message for example??
I'd change from using requestWithGraphPath to requestWithMethodName.
Here's the sample code:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"SELECT post_id, actor_id, message FROM stream WHERE filter_key = 'others '", @"query",
nil];
[facebook requestWithMethodName: @"fql.query"
andParams: params
andHttpMethod: @"POST"
andDelegate: self];
Then in the request didLoad method:
- (void)request:(FBRequest *)request didLoad:(id)result
{
if ([result isKindOfClass:[NSArray class]])
result = [result objectAtIndex:0];
friendID = [[result objectForKey:@"actor_id"]copy];
friendMsg = [[result objectForKey:@"message"]copy];
}
Facebook documentations on the iOS FB Connect SDK are very blend. It helps if you know a bit of SQL(fql) :)
精彩评论