我已經搜索完整的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