Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What kind of property should be set to nil in dealloc?

I'm using ARC. Will ARC automatically release all the properties in dealloc? Is it necessary to manual set all public properties and private field to nil? Are there any good pattern to follow?

like image 775
Leo Zhang Avatar asked Dec 30 '12 09:12

Leo Zhang


1 Answers

Under ARC, the pattern is... don't do anything in dealloc, or even implement it. ARC takes care of your properties and instance variables for you.

The only exception is that dealloc is a good place to unregister for notifications, if your object has registered for any.

like image 73
jrturton Avatar answered Nov 17 '22 12:11

jrturton