2012-05-04 11 views
0

私はテーブルビューの不整合例外を取得しています。 テーブルビューのセルアクセサリビューをタップすると、テーブルビューに追加のセルが表示され、現在表示している行の下にポップアップするコントロールパネルが表示されます。一方、APIへのHTTPリクエストは、データの2ページ目を取得しています。コントロールパネルをアニメーション化している間にデータが入ってきたら、クラッシュします。非同期にセクション内の行数を更新します

'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (31) must be equal to the number of rows contained in that section before the update (32), plus or minus the number of rows inserted or deleted from that section (1 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'

+0

httpコールバックコードを送信します。 – jackslash

+0

このエラーは、通常、データソースを正しく管理していないこと、および/または更新後にリロードデータを呼び出さないことを示しています。 – TommyG

+0

はい、reloadDataは、テーブルビューが新しいセルをアニメートしている間にhttpコールバックコードから呼び出されています。これを回避するにはどうしたらいいですか? – quantumpotato

答えて

0

解決済み! 問題はコンテンツの更新プログラムに直接は反映されませんでした。私はそうのようなnumberOfRowsInSectionの行を追加しました:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    NSInteger count = [self.sharedItems count]; 
    if (_contentPagesTotal > _contentPagesLoaded) { 
     // Add a row for the loading label 
     count++; 
    } 
    return count; 
} 

if (self.showLoadingRow) { 
    count ++ 
} 

とコンテンツのHTTPコールバックである: self.showLoadingRow = _contentPagesTotal>だから、ロードセルを

を_contentPagesLoadedそれがあってはいけないときにぶつかっていた。

関連する問題