On Aug 15, 2011, at 07:40 PM, John Joyce wrote: Thanks for the quick response, John.
> Hi Martin, > > NSPopover is not present in the frameworks on 10.6 > You will not be able to use it there. That I understand, but I want to use it in the app when it's running on Lion. When the app is running on 10.6 then I use a sheet instead. So the run-time switching is handled using the category methods below, but I don't know how to get past the error I see. Martin > > > On Aug 16, 2011, at 2:38 AM, Martin Hewitson wrote: > >> Dear list, >> >> I guess this is a really simple question to answer, but somehow my googling >> doesn't lead me to it. >> >> I have an app and I want to include NSPopovers when the app runs on Lion. I >> have some run-time way of finding out if it is Lion or not (see below), but >> when the app runs on 10.6 I get errors like: >> >> Symbol not found _OBJC_CLASS_$_NSPopover >> >> I have the deployment target set to 10.6 in Xcode and the base sdk set to >> 10.7. >> >> Am I doing something wrong? Is it possible to do what I want to do? >> >> Cheers, >> >> Martin >> >> Here's the category methods on NSApplication which I based on some code I >> found on this list, I believe. >> >> - (void)getSystemVersionMajor:(unsigned *)major >> minor:(unsigned *)minor >> bugFix:(unsigned *)bugFix; >> { >> OSErr err; >> SInt32 systemVersion, versionMajor, versionMinor, versionBugFix; >> if ((err = Gestalt(gestaltSystemVersion, &systemVersion)) != noErr) goto >> fail; >> if (systemVersion < 0x1040) >> { >> if (major) *major = ((systemVersion & 0xF000) >> 12) * 10 + >> ((systemVersion & 0x0F00) >> 8); >> if (minor) *minor = (systemVersion & 0x00F0) >> 4; >> if (bugFix) *bugFix = (systemVersion & 0x000F); >> } >> else >> { >> if ((err = Gestalt(gestaltSystemVersionMajor, &versionMajor)) != noErr) >> goto fail; >> if ((err = Gestalt(gestaltSystemVersionMinor, &versionMinor)) != noErr) >> goto fail; >> if ((err = Gestalt(gestaltSystemVersionBugFix, &versionBugFix)) != noErr) >> goto fail; >> if (major) *major = versionMajor; >> if (minor) *minor = versionMinor; >> if (bugFix) *bugFix = versionBugFix; >> } >> >> return; >> >> fail: >> NSLog(@"Unable to obtain system version: %ld", (long)err); >> if (major) *major = 10; >> if (minor) *minor = 0; >> if (bugFix) *bugFix = 0; >> } >> >> >> - (BOOL) isLion >> { >> unsigned major, minor, bugFix; >> [[NSApplication sharedApplication] >> getSystemVersionMajor:&major minor:&minor bugFix:&bugFix]; >> if (major == 10 && minor == 7) { >> return YES; >> } else { >> return NO; >> } >> } >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> 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/jjoyce%40apple.com >> >> This email sent to jjo...@apple.com > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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