Re: ARC clean up?
Re: ARC clean up?
- Subject: Re: ARC clean up?
- From: Kyle Sluder <email@hidden>
- Date: Wed, 14 May 2014 09:17:39 -0700
On May 14, 2014, at 9:12 AM, William Squires <email@hidden> wrote:
>
> Okay, in non-ARC code, one would override dealloc to put clean-up code (to release retained objects, close open streams/files, etc...). But where do we put this in ARC code?
You can still override -dealloc in ARC. You just can't release anything (ARC will do that for you; you can assign to nil if you need explicitly clear the pointer), nor can you call [super dealloc] (again, ARC will do that for you at the end of your -dealloc implementation).
But you should not be holding on to resources like file handles until -dealloc. You have no idea who might have retained a pointer to your object—use an explicit -close method instead.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >ARC clean up? (From: William Squires <email@hidden>) |