Weird iPhone Compiler/Architecture Bug
-
Jim B., Engineering Manager
- Feb 23, 2011
Alan on our iPhone team recently encountered a tricky bug that had to do with the ObjectiveC compiler and differences in architecture between ARM and x86. The Problem On the device (but not the sim), the following code would crash on views that implemented drawInRect methods that returned a CGPoint (instead of having a void return type like other drawInRect methods). for (id view in _subviews) { [view drawInRect:[view frame]]; } To make matters weirder, the pointer ‘view’ before stepping into drawInRect was not the same as the pointer ‘self’ after stepping into drawInRect! However, by typecasting view to the...