我已经搜索完整的Google搜索。但没有找到答案。 我在解析json结果中的对象数组时遇到了问题。 我有这样的JSON结果:想要使用json for ios5获取对象数组
[{ “created_at”: “星期六4月28日13时36分24秒+0000 2012”, “文”:“@ LisaPrejean爱你的工作做得很好! “, ”source“:”web“,”user“:{”id“:478983313,”name“:”3rd Dimension Media“, ”created_at“:”Mon Jan 30 21:51:20 +0000 2012“ “favourites_count”:0}, “retweet_count”:0}]
&从结果我想etract只有 “created_at” & “文本”
(无效)connectionDidFinishLoading:(NSURLConnection的*)连接 {
的NSString * jsonString = [[NSString的页头] initWithData:jsonData编码:NSUTF8StringEncoding]; NSLog(@“%@”,jsonString); self.jsonData = nil;NSArray *tweetArray = [jsonString JSONValue]; tweetTextArray = [NSMutableArray array]; for (NSDictionary *tweet in tweetArray)
{ [tweetTextArray ADDOBJECT:[鸣叫objectForKey:@ “文本”]]; [tweetCreated_atArray addObject:[tweet objectForKey:@“created_at”]]; } }
但得到在线EXC_BAD_ACCESS错误: 的NSArray * tweetArray = [jsonString JSONValue];
你看这个[教程](http://www.raywenderlich.com/5492/working-with-json-in-ios-5)? – mprivat
尝试过但出现错误 – amrita
错误是什么? – mprivat