2013年2月14日木曜日

[解決][iOS]SIGABRTエラー:-[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'

これがリジェクト理由の1つ。

てかアドバイスしてくれた、SIGABRT出るよークラッシュしてるよーって言われたんで、
ぬおーってなってたんだけど、理由がわかったんで、覚えているうちにメモ。

エラー内容はこれ
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: 
index 0 beyond bounds for empty array'
要はtableViewでatIndexPathの数が変わってるのに、そのCellの数は(変動があって)出せないよーって叫んでくれてる。

対処法。

tableViewに並ぶcellをviewDidAppearで再度リロードしてあげる

- (void)viewDidAppear:(BOOL)animated{
  [self.tableView reloadData];  
}


同じエラー名で違う原因の自分の記事です。
参考までにー
[解決][iOS]SIGABRTエラー:-[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'(2)というかいぶつくん