estimatedHeightForRowAtIndexPath causes crash after performing table updates

Originator:adam.weeks
Number:rdar://16432497 Date Originated:3/26/2014
Status:Open Resolved:
Product:iOS Product Version:iOS SDK 7.1
Classification: Reproducible:Yes
 
Summary:
When performing UITableView table updates via insertRowsAtIndexPaths, a crash will occur if the table view has a defined estimatedHeightForRowAtIndexPath delegate method.

Steps to Reproduce:
1. Create a UITableViewController with multiple rows of data.
2. Implement the estimatedHeightForRowAtIndexPath delegate method in the view controller.
3. Cause more data to get added to the table view by pressing a UIBarButton ([self.tableDataArray addObject:newData])
3. After adding data, call insertRowsAtIndexPaths method on the tableview.
4. Observe crash "__NSArrayM insertObject:atIndex:'object cannot be nil'"

Expected Results:
Recently added rows are properly inserted into tableview and app does not crash.

Actual Results:
App crashes with __NSArrayM insertObject:atIndex:'object cannot be nil' error

Version:
iOS SDK 7.1

Notes:
The only reason I found the solution was due to this SO answer. http://stackoverflow.com/questions/22205247/uitableview-insertrowsatindexpaths-throwing-nsarraym-insertobjectatindexobj

Configuration:
iOS SDK 7.1

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!