Re: Cocoa Newbie Crash Question
Re: Cocoa Newbie Crash Question
- Subject: Re: Cocoa Newbie Crash Question
- From: Nick Zitzmann <email@hidden>
- Date: Sun, 26 Oct 2003 19:38:46 -0800
On Sunday, October 26, 2003, at 06:34 PM, James Masasaki wrote:
int main( int argc, const char *argv[] )
{
NSAutoreleasePool *pool = NULL;
pool = [[NSAutoreleasePool alloc] init];
NSRunCriticalAlertPanel( @"This is an example of
NSCriticalAlertPanel",
[...]
What am I doing wrong?
You called NSRunCriticalAlertPanel(), an AppKit function, before you
called either NSApplicationMain() or NSApplicationLoad(). You must call
one of those functions before you can do just about anything with the
AppKit, or you're going to have problems.
I have not tested this on your example, but you may have better luck by
calling NSApplicationLoad() before NSRunCriticalAlertPanel()...
Also, you could consolidate those first two lines of main() and remove
a few redundant CPU instructions, like this:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://seiryu.home.comcast.net/
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone." - Bjarne Stroustrup
_______________________________________________
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.