简体   繁体   English

解析Facebook API调用-NSDictionary NSArray

[英]Parsing Facebook API calls - NSDictionary NSArray

Seem to be having issues accessing the data from a Facebook API call. 似乎在从Facebook API调用访问数据时遇到问题。 The returned data comes in the following order: 返回的数据按以下顺序排列:

{
comments =     {
    data =         (
                    {
        }
    )
}
}

Been trying for ages, but how would I access the data / comments in this scenario? 尝试了很长时间,但是在这种情况下我将如何访问数据/注释? My code is something along the lines of: 我的代码类似于以下内容:

NSLog(@"%@",allData);

for (NSDictionary *item in allData) {
    NSDictionary *comments = [item objectForKey:@"comments"];
    //ALSO TRIED
    NSArray *comments = [item objectForKey:@"comments"];
}

Both of the above methods seem to throw up an error 以上两种方法似乎都引发错误

Argh, what a plum! 啊,真是梅子!

Basically didn't need the for loop, so it would just be: 基本上不需要for循环,因此只需:

[allData objectForKey:@"comments"]

Thanks guys, will leave this up for others :D 谢谢大家,将这个留给其他人:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM