• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: build for 10.3.9 with Xcode 3.0
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: build for 10.3.9 with Xcode 3.0 (From: "Drew Colace" <email@hidden>)
 >Re: build for 10.3.9 with Xcode 3.0 (From: "Drew Colace" <email@hidden>)

  • Prev by Date: Re: Breakpoints doesn't work - more info
  • Next by Date: Re: Breakpoints doesn't work - more info
  • Previous by thread: Re: build for 10.3.9 with Xcode 3.0
  • Next by thread: [Xcode-Users] AppleScript Command for "Open Quickly"?
  • Index(es):
    • Date
    • Thread