Synthesized ObjC ivars (iPhone Simulator)
Synthesized ObjC ivars (iPhone Simulator)
- Subject: Synthesized ObjC ivars (iPhone Simulator)
- From: Fritz Anderson <email@hidden>
- Date: Tue, 11 May 2010 12:41:32 -0500
iPhone OS and 64-bit Intel use the "modern" Objective-C runtime, one of the features of which is that you can declare a @property without an instance variable to back it, and @synthesize will synthesize an instance variable for you. It makes @interfaces a lot more gainly.
I have an iPhone project. I find that if I strip out my instance variables and build for the iPhone Simulator (Xcode 3.2.2, GCC 4.2, 10.6.3), I get an error at every @synthesize, complaining that there is no backing ivar.
The documentation for the Simulator says,
> iPhone OS supports the Objective-C runtime introduced in Mac OS X 10.5 except for access to Objective-C class metadata. This means that, if your application accesses Objective-C class metadata, it may not run on iPhone Simulator. See Objective-C Runtime Reference for more information.
(The Objective-C Runtime Reference is a dead end for my question.)
This is confusing. I've seen it explicitly said that I can omit ivars in the "modern" runtime, which explicitly includes the iPhone. Here it says the iPhone itself does _not_ support the part of the modern runtime that "accesses Objective-C class metadata," which for all I know includes synthesis of instance variables.
OR it may be trying (but failing) to convey that I can use synthesized ivars on device builds, but not simulator builds; this kind of makes sense, because I see from lipo that the Simulator is a thin 32-bit Intel application.
If true, this is very disappointing, because it means synthesized ivars are effectively unavailable in iPhone development (one could set a per-SDK preprocessor macro and #if the ivars out for device builds, but that defeats the goal of ivar declarations' not cluttering the header).
Is this the full story? If I'm right, is there some way I can work around it?
[Sent to xcode-users instead of objc-language because it relates to a possible limitation of the Simulator platform, which is a tools component, not a language feature.]
— F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden