I just downloaded Xcode6 Beta6 and found some strange defects in my App. After some initial debugging, I have found that heightForRowAtIndexPath is called numerous extra times and is causing some ill effects.

Normally, I would expect heightForRowAtIndexPath to be called 2 extra times than the rows I am displaying. So when I hardcode numberOfRowsInSection to return 3, I should be seeing heightForRowAtIndexPath get called 5 times. In iOS 7 that is the case, but when I test in Xcode6 Beta6 I am seeing heightForRowAtIndexPath get called 7 times. When I return 4, the method gets called 9, 5 and its 11. So it seems the pattern is twice the number of rows I am hardcoding + 1.

Has anyone else encountered this problem or found a way to solve it? Just being able to confirm that this is an iOS bug would be a huge help because then I can defer the defect for later as Apple may fix this problem on their own.

Edit: This issue still exists in Xcode 6 GM

Edit 2: Apple responded and closed my bug report, here is there response:

The API contract of a delegate is that we can call this method as much as we want.

I guess we just have to deal with this and should code to not rely on exactly when this delegate is called.