Which of the following scenarios is correct coding practice, given that player is (nonatomic, retain), and is synthesized using player = _player.
Scenario A
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
self.player = mp;
[mp release];
Scenario B
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
self.player = mp;
Up until this point I have been using scenario A as a general practice, but I think this may be causing memory leaks within my code.
Thanks for any help.
EDIT 1:
And does the same apply to Timers, they are causing me real hassle. If I'm using the code below is this correct? If timerMap is also (nonatomic, retain), and uses timerMap = _timerMap;
self.timerMap = [[NSTimer scheduledTimerWithTimeInterval:fps target:self selector:@selector(updateAnimationTimer) userInfo:nil repeats:YES] autorelease];
And when releasing is it fine to just invalidate, or should it be invalidate then release?