P 89 Hillegas.
May I ask a question about dealloc.
In this exercise, a very simple program synthesizes speech, using an instance of NSSpeechSnythesizer.
The ivar is instantiated in the init call, thus;
So, having meticulously studied the "rules" I wrote a dealloc method like so. ( The documentation does not mention that initWithVoice is autoreleased, but rule one, AFAIR, says an **alloc** needs to be released. ( Not running GC)
Now to be fair, Hillegas does **not** use a dealloc, so I wonder if someone can clear up this confusion, ie why dealloc is not called. ( I am assuming it is not called as NSLog is not written).
Thanks
May I ask a question about dealloc.
In this exercise, a very simple program synthesizes speech, using an instance of NSSpeechSnythesizer.
The ivar is instantiated in the init call, thus;
Code:
-(id) init
{
NSLog(@"Initializing speech syntersizer");
self = [super init];
if ( self)
{
speechSynth = [[NSSpeechSynthesizer alloc] initWithVoice: nil];
}
return self;
}
So, having meticulously studied the "rules" I wrote a dealloc method like so. ( The documentation does not mention that initWithVoice is autoreleased, but rule one, AFAIR, says an **alloc** needs to be released. ( Not running GC)
Code:
-(void) dealloc
{
NSLog(@"Deallocking speech syntersizer");
[speechSynth release];
[super dealloc];
Now to be fair, Hillegas does **not** use a dealloc, so I wonder if someone can clear up this confusion, ie why dealloc is not called. ( I am assuming it is not called as NSLog is not written).
Thanks