I had a fun little problem pop up at my client site today. We had a tableview that was displaying data that looked perfect when running on everything except for an iPhone 5s. After a little bit of DuckDuckGo-ing, we came across these Stack Overflow questions here and here that suggested that the heightForRowAtIndexPath method might be the culprit.
When I went and dug in, I found this warning (I did do some cut and paste to get the warning just over near the code):

If you can’t read it, that warning says, “Conflicting return type in implementation of ‘tableView:heightForRowAtIndexPath:’: ‘CGFloat’ (aka ‘double’) vs ‘float'”
The code was the following:
- (float) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row % 2 == 0) {
return 247.0;
}
else {
return 315.0;
}
}
The signature for that method means that the code should have looked like this:
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row % 2 == 0) {
return 247.0;
}
else {
return 315.0;
}
}
So what is the explanation? Basically CGFloat was typedef’ed as float. However, Apple wanted you to use CGFloat in case they ever changed what a CGFloat was going to stand for. Apparently, with the move to 64-bit, Apple has done just that. In 32 bit versions, the signatures were identical. However, now in 64-bit land, because the method was returning the wrong type, iOS considered the return value to be 0, breaking our layout. By only changing the return type in the signature to the proper value, the app functioned again properly.
Keep this in mind the next time you might think about being smarter than the language designers and consider not using their typedefs.
In this week’s episode, I interviewed 

I did it! Mission Accomplished (and I don’t mean in that ironic “banner on an aircraft carrier” way).
It has been 3 weeks since I last published a podcast. I had some interviews fall through and then I let myself get caught up spending every waking minute working on my Stir Trek presentation. And before I knew it, I was just out of the habit of publishing my podcast. I knew I had to put something out so that I didn’t get caught in a serious
This is definitely going to be one of those posts where I’m posting this not only for others to find while they are Binging and Googling, but for future Pete to come back and re-figure out how to do something that took him some time to figure out in the first place. I’ve had several posts like that (