Re: how to warn users of wrong system
Re: how to warn users of wrong system
- Subject: Re: how to warn users of wrong system
- From: Shaun Wexler <email@hidden>
- Date: Fri, 10 Oct 2003 11:09:22 -0700
On Oct 10, 2003, at 8:50 AM, matt neuburg wrote:
My app is now Panther-only, so the first thing I want to do is
check the appkit version and put up a dialog warning if we can't
run on the user's system (and quit). I put such a check in my
main controller object's init, and it worked for a while, but now
it turns out that this is not soon enough: because of
incompatibilities in the nib file format, we crash before we even
reach this code if we try to start up on a pre-Panther system.
So I'm guessing I need to move the check into main.
My question is: if NSApplicationMain hasn't been called yet, how
can I put up a dialog? NSRunAlertPanel doesn't work at that
stage... Thx - m.
You could subclass NSApplication, such as:
BOOL runningPanther;
+ (NSApplication *)sharedApplication
{
NSApp = [super sharedApplication];
runningPanther = [NSApp
respondsToSelector:@selector(replyToOpenOrPrint:)];
if (!runningPanther) {
[NSApp run];
}
return NSApp;
}
- (void)finishLaunching
{
if (!runningPanther) {
NSString *title = @"Unable To Launch Application";
NSString *msg = @"Mac OS X 10.3 \"Panther\" or greater is required.";
int returnCode;
returnCode = NSRunInformationalAlertPanel(title, msg, @"Quit", nil,
nil);
exit(0);
}
[super finishLaunching];
}
Written in Mail... usual disclaimers apply.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.