cross development, missing methods
-
Hi,
In short, my question is: when cross developing for multiple OS
versions, how do people deal with Objective-C methods that exist in
only some of the versions? Do you have multiple targets compiling
against different SDKs?
Details...
I'm on 10.5 with Xcode 3.1 and I tried to create a project that will
run on 10.3-10.5. I followed the instructions in the "Cross
Development Programming Guide" and used the 10.5 SDK while setting the
"Mac OS X Deployment Target" build setting to 10.3. When I run the
binary on 10.4, I get errors like this:
-[ABMultiValue valueForIdentifier:]: selector not recognized [self =
0x15d525c0]
After getting the runtime error, I checked the docs and discovered
that this method showed up in 10.5.
I was hoping I could get the compiler to warn me about these things.
Is there a compiler flag that helps? Or should I forget about the
"Deployment Target" build setting and create multiple targets or
projects that use different SDKs?
thanks,
Rob -
On Oct 7, 2008, at 10:19 AM, Robert Nikander wrote:> I was hoping I could get the compiler to warn me about these
> things. Is there a compiler flag that helps? Or should I forget
> about the "Deployment Target" build setting and create multiple
> targets or projects that use different SDKs?
This is a problem that can be solved by using an older SDK. If you
want to use methods added to future versions of Mac OS X, then use -
respondsToSelector: and the -performSelector: methods.
Nick Zitzmann
<http://www.chronosnet.com/> -
On Oct 7, 2008, at 11:19 AM, Robert Nikander wrote:> I was hoping I could get the compiler to warn me about these
> things. Is there a compiler flag that helps? Or should I forget
> about the "Deployment Target" build setting and create multiple
> targets or projects that use different SDKs?
Create a new build settings configuration for testing for such
symbols. In your real deployment configuration, continue to use the
10.5 SDK and the 10.3 deployment target. However, in your testing
configuration set the SDK to 10.3 as well. This will cause either
warnings or errors for stuff that wasn't implemented on 10.3. As you
find each, modify the code to work in the case where the new API isn't
available (-respondsToSelector:, etc.).
Cheers,
Ken


