Hi I using blocks to implement the pushing of viewcontrollers onto a stack. My code is as follows:
My Question is, for memory management, where can I release the firstView instance? I tried to release it in the completion block itself but I will get a “memory issue” if I press the back button from splashView to the firstView
FirstViewController *firstView = [[FirstViewController alloc]init];
[firstView setCompletionHandler:^(BOOL isRequestInvite){
splashView=[[AuthSplashController alloc] init];
[splashView setCompletionHandler:onceCompleted];
[navCon pushViewController:splashView animated:YES];
//[firstView release];
}];
[navCon pushViewController:firstView animated:NO];
So in this case, where would be the best place to release firstView?
I think you can
releasefirstViewafter pushing it on navigation stack, because retain count will be increased:Or you can mark that object as
autoreleased: