0

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

Community
  • 1
  • 1
Stephane
  • 4,978
  • 9
  • 51
  • 86
  • You are not *creating* anything. You create an object by invoking a method whose name begins with "alloc", "new", "copy", or "mutableCopy". – albertamg Sep 10 '11 at 19:36

1 Answers1

1

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.

PengOne
  • 48,188
  • 17
  • 130
  • 149