iPhoneアプリ初心者です。JSONデータを取得して解析し、iPhoneの表に表示する方法を学んでいます。そのために私は経験していthis videoます。
私はこれをxibファイルで作成し、完全に機能しています。
私が試みていたのは、これを行うことStoryboardです。と同じことをしましたStoaryboardが、実行は下の行で中断されています。
cell.textLabel.text = [[news objectAtIndex:indexPath.row] objectForKey:@"title"];
私が持っているコードは
-(UITableViewCell *) tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"i m here 1");
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MainCell"];
NSLog(@"i m here 2");
if (cell==nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MainCell"];
NSLog(@"i m here 3");
}
NSLog(@"i m here 4");
cell.textLabel.text = [[news objectAtIndex:indexPath.row] objectForKey:@"title"];
// cell.textLabel.text = @"dadsf ad";
NSLog(@"i m here 5");
return cell;
}
ではNSLog、 まで出力を取得しますi m here 4。
コメントcell.textLabel.text = [[news objectAtIndexしてコメントを外すcell.textLabel.text = @"dadsf ad";と、動作しdadsf ad、iPhone で表示されます。
// cell.textLabel.text = [[news objectAtIndex:indexPath.row] objectForKey:@"title"];
cell.textLabel.text = @"dadsf ad";
で実行するとcell.textLabel.text = [[news objectAt、画面の下になります。

ノート:
私もシミュレーターに行きましたがReset Content and Setting、まだ同じ問題に直面しています。理由はありますか?
更新 1
を有効にしNSZombieEnabledてコードを実行します。私はNSLOGに入る
JSONNewsStoryBoard[19389:11303] i m here 4
2013-01-06 11:26:15.327 JSONNewsStoryBoard[19389:11303] *** -[CFArray objectAtIndex:]: message sent to deallocated instance 0x7497040
以下はスクリーンショットです。

更新 2 - 回答
追加NSLog(@"checking news count %d", [news count]);してみましたcellForRowAtIndexPathが、同じ問題が発生しました。手段newsは null でした。
だから私は追加しました
news = [NSJSONSerialization JSONObjectWithData:data options:nil error:nil];
でcellForRowAtIndexPath、それはうまくいきました。:) :)