I have seen this being asked here many times but none of the solutions worked for me. Here is my code snippet:
- (UITableViewCell *)tableView:(UITableView *)
In my case, what was happening was that I had not kept a strong pointer to the tableview's dataSource. So when the tableview was scrolled, the datasource had already been freed and set to nil, which led to the tableview getting 0 for numRowsForSection and nils for cellForRowAtIndexPath.
If anyone has a similar problem, you might look if your datasource and/or custom objects are retained properly.