OK, problem solved, sort of. Using NSClassFromString makes it work on both systems. I think I prefer this solution rather than hacking the headers.
Many thanks to all who helped! Martin On Aug 15, 2011, at 08:31 PM, Greg Parker wrote: > On Aug 15, 2011, at 10:50 AM, David Duncan wrote: >> On Aug 15, 2011, at 10:47 AM, Kyle Sluder wrote: >>> On Mon, Aug 15, 2011 at 10:45 AM, David Duncan <david.dun...@apple.com> >>> wrote: >>>> In either case, the best general way to determine availability of >>>> weak-linked implementations is to test for them directly rather than using >>>> a system version check (like gestalt). If your using Clang (which I >>>> suspect you are not given your error) you could just use: >>>> >>>> "if ([NSPopover class]) { /* do stuff with popovers */ } else { /* do >>>> stuff without */ }" >>> >>> Is it the case that this check will only work on 10.6.8 or newer, and >>> that one should fall back on NSClassFromString() if supporting an >>> older version of Snow Leopard? >> >> I'd actually forgotten that this required 10.6.8. If you can require 10.6.8, >> I would use the new style universally. If you cannot I would use the >> NSClassFromString style until you can. > > There's a bug here. The Objective-C runtime on 10.6.8 supports weak-linked > classes, but the NS_CLASS_AVAILABLE macro does not know that. > > You can fix this if you are willing to hack your SDK headers. In > Foundation/NSObjCRuntime.h, find the macro definition of NS_CLASS_AVAILABLE, > and remove the check for __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_7. > > > -- > Greg Parker gpar...@apple.com Runtime Wrangler > > > _______________________________________________ > > 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/martin.hewitson%40aei.mpg.de > > This email sent to martin.hewit...@aei.mpg.de ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________ 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