Search code examples
iphoneiosios4uiapplicationdelegateuiapplication

Releasing appDelegate instances?


Possible Duplicate:
When should I release [[UIApplication sharedApplication] delegate] object?

I'm creating instances of UIApplication many times in my app to access shared infos, like this:

MyAppDelegate *appDelegate =  (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.ListingNav.navigationBarHidden = FALSE;

Well, how should it release all these appDelegate objects? Won't they create accumulated memory leaks ?

Thx for helping,

Stephane


Solution

  • In general, if you do not call alloc or retain, then you do not need to call release. You do not need to release appDelegate in this use case.