dealloc method not executing

Discussion in 'Mac Programming' started by sailorfoley, Aug 20, 2007.

  1. macrumors newbie

    Joined:
    Aug 20, 2007
    #1
    Hey all,

    i have a very simple cocoa app that counts the letters in a NSTextField. I have a controller object with outlets and actions defined to do the work. This controller object has a dealloc method but it doesn't seem to execute when the application ends and is being deallocated. Everything else executes as expected except for the dealloc. I even put a breakpoint in the code to see if it executes but it never breaks in dealloc.Below is the code.

    Any ideas / suggestions are welcome.

    #import "AppController.h"

    @implementation AppController

    - (IBAction)countLetters: (id)sender
    {
    NSString *message = [inputTextBox stringValue] ;
    int length = [message length] ;
    NSString *newMessage = [NSString stringWithFormat:mad:"%@ has %d letters",message,length] ;
    [letterCounter setStringValue:newMessage] ;

    NSLog(@"Set new value to %@",message) ;

    }

    - (void) dealloc
    {
    NSLog(@"testing....") ;
    NSLog(@"Deallocating AppController") ;
    [super dealloc];
    }

    - (void)awakeFromNib
    {
    [inputTextBox setStringValue:mad:"this is the initial string"];
    NSLog(@"waking up the NIB");
    }

    - (id)init
    {
    [super init];
    NSLog(@"Init...");
    return self ;
    }

    @end
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    From Apple:

     

Share This Page