开发者

Releasing appDelegate instances? [duplicate]

开发者 https://www.devze.com 2023-04-04 04:25 出处:网络
This question already has answers here:开发者_运维知识库 Closed 11 years ago. Possible Duplicate:
This question already has answers here: 开发者_运维知识库 Closed 11 years ago.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号