1

我正在尝试使用图形 api 获取 facebook 帖子的评论。现在我有以下方法。

+(NSArray *)getCommentsWithParam:(NSString *)Param
{
    NSString *request = [NSString stringWithFormat:@"https://graph.facebook.com/comments/?ids=%@",Param];
    NSLog(@"request is %@",request);
    NSString *vfk = [NSString stringWithFormat:@"comments.data"];
    return [[self executeGenkFetch:request] valueForKey:vfk];
}

executeGenkFetch只是要解析 json 并将NSDictionary结果返回给我。但是现在当我读到这样的结果时。

-(void)getComments{
    NSArray *comments           = [GenkData getCommentsWithParam:_commentsUrl];
    NSLog(@"Comments are %@", comments);
}

我总是得到(空)。这就是json的样子。

{
   "http://www.krcgenk.be//nl/nieuws/show/krc-genk-speelt-1-1-gelijk-op-vfb-stuttgart/1329": {
      "comments": {
         "data": [
            {
               "id": "412008348889230_2723627",
               "from": {
                  "name": "Put Patrick",
                  "id": "1090951059"
               },
               "message": "Proficiat mannen",
               "can_remove": false,
               "created_time": "2013-02-15T00:10:12+0000",
               "like_count": 4,
               "user_likes": false
            },
            {
               "id": "412008348889230_2723878",
               "from": {
                  "name": "Benny Froyen",
                  "id": "1095529244"
               },
               "message": "Knap resultaat voor Genk. Alles blijft open voor de terugwedstrijd in Genk. Leuk!",
               "can_remove": false,
               "created_time": "2013-02-15T02:25:51+0000",
               "like_count": 1,
               "user_likes": false
            }
 ],
         "paging": {
            "next": "https://graph.facebook.com/412008348889230/comments?limit=25&offset=25&__after_id=412008348889230_2725492"
         }
      }
   }
}
4

0 回答 0