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; 
} 
+0

クラッシュログを投稿できますか? –

+0

ログには何もありません 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

+2

クラッシュし、バックトレースを入力し、コンソールウィンドウでenterを押します。これは、クラッシュ時のスタックトレースを与えるはずです。また、Xcode 4を使用している場合は、例外ブレークポイントを設定することをお勧めします。 http://www.dosomethinghere.com/2011/04/18/xcode-4-exception-breakpoint/ –

答えて

1

は、まあ、それは私がデリゲートアレイ用のオブジェクトを移入している間のようです、私はプロパティの前に「自己」の単語を使用していなかった第一の要素へのポインタを設定することで、すべての時間をもたらし、私がしようとしたとき、最終的に私のプログラムをクラッシュされましたそれを下にスクロールします。すべてのコメントに感謝します。

関連する問題