2011-08-03 66 views
1

我需要獲取用戶新聞聯播數據。iOS Facebook新聞聯播

目前我使用的是這樣的:
[[FBManager defaultManager]getFBRequestWithGraphPath:@"me/home" params: andDelegate:self];

然後:

- (void)request:(FBRequest *)request didLoad:(id)result { 
if ([result isKindOfClass:[NSArray class]]) 
    result = [result objectAtIndex:0];} 

結果給了我一組數據。但如何分別提取這些?例如,可能的名稱和消息??

回答

0

我會從使用requestWithGraphPath更改爲requestWithMethodName。

這裏的示例代碼:

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];

在請求didLoad方法

然後:

- (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]; 
} 

在iOS FB連接SDK的Facebook資料的主要非常共混物。它有助於如果你知道一點SQL(fql):)