Help with Macintosh programming

macintosh programming, mac programming, mac os programming, mac os x programming, mac programming language, mac programing

applicationWillTerminate are not called

Hi,

I’m new to mac programming, so please sorry for my dumb question :)
I added two deligate methods to my code: windowWillClose called well
(I see it in the debugger window), but applicationWillTerminate was
never called. Any ideas? You can see my current code below:

- (void)windowWillClose:(NSNotification *)notification {
// [[NSApplication sharedApplication] terminate:self];
// [wMain setDelegate:nil];
[self release]; // executed well

}

- (void)applicationWillTerminate:(NSNotification *)notification {
[self saveSettings];  // never executed

}

Thanks.

* posted via http://mymac.ws

.
posted by admin in Uncategorized and have Comments (2)

2 Responses to “applicationWillTerminate are not called”

  1. admin says:

    - Hide quoted text — Show quoted text -

    alexander <m…@mymac-dot-ws.no-spam.invalid> wrote:
    > Hi,

    > I’m new to mac programming, so please sorry for my dumb question :)
    > I added two deligate methods to my code: windowWillClose called well
    > (I see it in the debugger window), but applicationWillTerminate was
    > never called. Any ideas? You can see my current code below:

    > – (void)windowWillClose:(NSNotification *)notification {
    > // [[NSApplication sharedApplication] terminate:self];
    > // [wMain setDelegate:nil];
    > [self release]; // executed well
    > }

    > – (void)applicationWillTerminate:(NSNotification *)notification {
    > [self saveSettings];  // never executed
    > }

    How are you exiting the application? What steps have you taken to make
    this actually get called? Your object either needs to be the NSApp
    delegate, or you need to have explicitly signed up for the
    applicationWillTerminate notification; it won’t happen magically.

  2. admin says:

    > Your object either needs to be the NSApp
    > delegate, or you need to have explicitly signed up for the
    > applicationWillTerminate notification; it won’t happen magically.

    Thank you very much for pointing me in the right direction. I added
    [[NSApplication sharedApplication] setDelegate:self] to object
    initialization and all works well now :)

    Thanks a ton.

    * posted via http://mymac.ws