1
AppDelegateで宣言された配列から自分のアプリケーションのデータをUITableViewにロードしました。しかし、私がテーブルビューをスクロールしようとすると、EXC_BAD_ACCESSエラーが発生します。以下は、私がセルを構成するために使用したコードです。スクロール中にEXC_BAD_ACCESSエラーが発生する
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
ScoutAppDelegate *appDelegate = (ScoutAppDelegate *)[[UIApplication sharedApplication] delegate];
return appDelegate.playerList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
ScoutAppDelegate *appDelegate = (ScoutAppDelegate *)[[UIApplication sharedApplication] delegate];
Player *tempPlayer = (Player *)[appDelegate.playerList objectAtIndex:indexPath.row];
cell.textLabel.text= tempPlayer.playerName;
return cell;
}
クラッシュログを投稿できますか? –
ログには何もありません 2011-06-21 15:49:33.519スカウト[5799:207]ファイル:/ Users/ryanfannin /ライブラリ/アプリケーションサポート/ iPhone Simulator/4.3.2/Applications/C78E05BD-8E2B-48E0-スカウト[5799:207]データベースを開始しました 2011-06-21 15:49:33.969スカウト[5799:207]レコード数:833 – slonkar
クラッシュし、バックトレースを入力し、コンソールウィンドウでenterを押します。これは、クラッシュ時のスタックトレースを与えるはずです。また、Xcode 4を使用している場合は、例外ブレークポイントを設定することをお勧めします。 http://www.dosomethinghere.com/2011/04/18/xcode-4-exception-breakpoint/ –