On Jul 3, 2009, at 10:06 AM, Steve Christensen wrote:
For the case of a function, if you're deploying on 10.4 but using a 10.5 function, that function will be weak-linked so doing a runtime check is both faster and more accurate in determining whether a function exists or not. For a Cocoa class method, you could replace the test with a call to -respondsToSelector: to determine if it exists or not. In both cases you're taking a feature-based approach rather than a "I know this feature showed up in this OS version" approach.
Just as a caution, you may run across functions that don't have the appropriate weak attribute in the header, so you'll crash at launch time on 10.4 (this bit me recently with CFStringTokenizer, rdar://problem/6781636 ) So if you're checking function pointers against NULL, check the header to make sure they have the correct accessibility macro.
-- Adam
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com