How does Objective C on the iPhone compare to Objective C on the Mac and what version of objective C is the various iPhone versions?
+6
A:
iPhone OS debuted shortly before Leopard, and it has been Objective-C 2.0 from the get-go. Aside from the lack of Garbage Collection on iPhone, the key difference is that the Objective-C runtime on iPhone is always Modern Runtime, as opposed to the Legacy Runtime for 32-bit Mac apps. (See this Apple doc.) One of the important results of this distinction is that instance variables are non-fragile (meaning that when you change the instance variables of a class, you don't have to recompile its subclasses) and it can synthesize variables for properties.
Quinn Taylor
2009-12-16 04:36:53
Interesting. Did not know about the Legacy Runtime vs Modern runtime bit. I have only been developing for Mac since Leopard and only targeting Leopard or higher, so I was unaware of the difference. Thanks.
Brandon Bodnár
2009-12-16 04:46:11
No problem, I only learned about the fine distinctions in the last year. If you don't have to support pre-Leopard, you're fortunate indeed. Still, it's good to be aware that 32-bit apps still use the Legacy runtime.
Quinn Taylor
2009-12-16 05:42:55