I have the following statement in my viewWillAppear controller:
connectionInprogress = [[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:YES];
What is the proper place to release it? That is can I just do it in viewDidUnload or does it make more sense to do it in viewDidDissapear?
I guess the fundamental question here is that does viewDidUnload get called every time a viewDidDissapear gets called?
No
viewDidUnloadis paired withviewDidLoadand may never get called, which is why you should also release your instance variables indealloc.viewDidUnloadis called if the view controller is sent a memory warning.You should release the
NSURLConnectionin the callback functions:connectionDidFinishLoading:andconnection:didFailWithError:. Only one will be called.Check out the Xcode documentation for URL Loading System Programming Guide : Using NSURLConnection.