On Mon, Jun 29, 2009 at 10:21 AM, Peter
Mulholland<[email protected]> wrote:
> I am not using NSApplicationMain() as this would attempt to load the original 
> app's nib. Instead I do this:
>
> int main(int argc, char *argv[])
> {
>        [[NSAutoreleasePool alloc] init];
>        [NSApplication sharedApplication];
>
>        if ([NSBundle loadNibNamed:@"RegDialog" owner:NSApp])   // Load our 
> bundle
>        {
>                NSData *icon_data = [NSData dataWithBytes:Security_icns_data 
> length:sizeof(Security_icns_data)];
>                NSImage *icon = [[NSImage alloc] initWithData:icon_data];
>
>                if (icon)
>                        [NSApp setApplicationIconImage:icon];
>
>                [NSApp run];
>        }
>        else
>        {
>                ShowDialog(NSCriticalAlertStyle, "Couldn't load 
> RegDialog.nib\n\nTry reinstalling the application. If this fails please 
> contact Support.");
>                return 1;       // Stop stub relaunching us
>        }
>
>        return 0;
> }

I agree this is a little nuts. But you should be calling
NSApplicationLoad() to initialize NSApplication before doing any Cocoa
stuff.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to