You tested your app on the Simulator and everything is fine. You’ve install it on the
iPhone, and when you reach a certain TableViewController your app crashes with the
How would you approach this issue?
Using common sense, try to set a breakpoint in each function from your
TableViewController, then step through them to see in/after which function does the crash
happens. In my case, the responsible code was found in the method:
It entered this function, once for each cell, but it crashed after exiting. As a new iOS
developer, I was trying to set a couple of different UITableViewCell in one
TableViewController. Here is a sample of the code I was using in the first version:
As you can see in the above code, after I was getting a generic cell, I would try to
replace it with a custom cell. I guess that somewhere after
some other piece of code was trying to cleanup the unused cells. Figuring this, it was
pretty easy to get it fixed. Using the same sample code:
Even if is not the optimal way to use custom TableViewCells, it solves the crash problem.