How to avoid XCode framework weak-linking problems?

Posted by Frank R. on Stack Overflow See other posts from Stack Overflow or by Frank R.
Published on 2010-03-30T12:29:40Z Indexed on 2010/03/30 12:33 UTC
Read the original article Hit count: 511

Filed under:
|
|
|
|

Hi,

I'm building an application that takes advantage of Mac OS X 10.6-only technologies, but without giving up backwards compatibility to 10.5 Leopard.

The way I do this is by setting the 10.6 SDK as the base SDK, weak-linking all frameworks and setting the deployment target to 10.5 as described in:

http://developer.apple.com/mac/library/DOCUMENTATION/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html

This works fine; before making a call that is Snow Leopard-only I need to check that the selector or indeed the class actually exist. Or I can just check the OS version before making the call.

The problem is that this is incredibly fragile. If I make a single call that is 10.6 only I blow Leopard-compatibility. So using even the normal code code completion feature can be dangerous.

My question: is there any way of checking which calls are not defined on 10.5 before doing a release build? Some kind of static analysis, or even just a trick (a target set the other SDK?) would do.

I obviously should test on a Leopard machine before releasing anything, but even so I can't possibly go through all paths of the program before every release.

Any advice would be appreciated.

Best regards,

Frank

© Stack Overflow or respective owner

Related posts about xcode

Related posts about weak-linking