By default an object returnd by method alloc
or copy
has retain count
equals to 1, so you have to release it by yourself.
But through NSTimer sample codes
// in one method start the timer (which myTimer is an Class Instance) myTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(method:) userInfo:nil repeats:YES]; // in another method [myTimer invalidate]; myTimer = nil;
My question is why [NSTimer sche**] returns an object that you needn't retain, but you can access it anywhere. And you needn't release it but only invoke invalidate
on it.