0
我是Object-c中的新成員,並且希望在Xcode 4中使用JSON數據源創建基於UITableViewController的應用程序。 我導入了JSON框架並定義了一個NSMutableArray以將其填充到響應中:在UITableViewController中訪問NSMutableArray崩潰
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
[responseData release];
items = [responseString JSONValue];
[self.tableView reloadData];
}
我一切都進行得很順利,但是當我嘗試訪問我的項目數組中的
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
功能,它崩潰我的應用程序。
可能是什麼問題? 在此先感謝!
更新: 我修改了數組填充部分的代碼,它解決了崩潰問題: NSMutableArray * a = [responseString JSONValue];
for(NSDictionary *it in a) {
[items addObject:it];
}
但我仍然不知道爲什麼......
這工作!非常感謝! – haxpanel