Re: build for 10.3.9 with Xcode 3.0
Re: build for 10.3.9 with Xcode 3.0
- Subject: Re: build for 10.3.9 with Xcode 3.0
- From: Chris Hanson <email@hidden>
- Date: Fri, 16 Nov 2007 16:39:26 -0800
On Nov 16, 2007, at 4:17 PM, Drew Colace wrote:
No. MACOSX_DEPLOYMENT_TARGET sets the lower bound for acceptable OS
to
run on whereas SDKROOT(_ppc or _i386) sets the upper bound of which
AppKit, Foundation, etc. calls can be made, provisionally.
The above is true and is the general rule of thumb for multi-OS
development on Mac OS X
However, you can't use a "bare" Objective-C class declared in a more
recent SDK on an earlier OS, whether by trying to instantiate it in
your code or by subclassing it.
For example, if you're writing code to use NSXMLDocument on 10.4 but
do something else on 10.3, you can't write it as
if (runningOnPanther) {
// 10.3-appropriate code path
} else {
NSXMLDocument *document = [[NSXMLDocument alloc] init];
}
The generated binary will attempt to reference the NSXMLDocument class
object at load time. It's undefined (not simply Nil) on 10.3 and so
your app will refuse to launch due to a load-time failure.
The "solution" -- such as it is -- is to either partition your 10.4-or-
later code into a separate bundle and load & call that on 10.4, or to
write the above in this fashion:
if (runningOnPanther) {
// 10.3-appropriate code path
} else {
Class MyNSXMLDocument = NSClassFromString(@"NSXMLDocument");
id document = [[MyNSXMLDocument alloc] init];
}
Trying to subclass a 10.4-or-later class in a 10.3-and-later
application will fail for similar reasons, but without such a
workaround.
It's unfortunate, but there are significant technical obstacles to
making weak-linked classes just become Nil on systems where they're
not implemented, much less handling subclassing of Nil in such cases.
In-depth discussion of these specific issues is probably more
appropriate on the objc-language list than on xcode-users.
-- Chris
_______________________________________________
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