开发者

NSInternalInconsistencyException: no section at index 4

Hi I ha开发者_开发知识库ve a simple database app on the iPhone that uses core data. I was just looking at some Flurry exception reports and I'm seeing the following error:

NSInternalInconsistencyException: no section at index 4

The number varies in the reports, but it is always the same message. Any idea on what this means and where to start my debugging efforts?


It probably means that you have a tableview which is asking for a non existent section. Most likely, you are returning incorrect values from numberOfSectionsInTableView: for some reason.


Old question, but it's the top hit on Google - so here's a slightly more concise answer:

I've had this error message appear when an incorrect value is passed into NSFetchedResultsController's objectAtIndexPath:

You pass in a NSIndexPath object, which probably has a section index which is beyond the value that you returned from numberOfSectionsInTableView:


try to use NSIndexPath *path = [NSIndexPath indexPathForItem:item inSection:0];

instead of NSIndexPath *path = [NSIndexPath indexPathWithIndex:item];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜