What method should be used to release the object?

I found that iphone has viewDidUnload and dealloc. I want to release an object. Which method should be used to free an object? What is the difference between the two?

+3
source share
3 answers

Send releaseor autoreleaseto free an object. You must not send dealloc; Obj-C runtime will do this.

If you ask where you should publish an object belonging to him, read: " When should I release objects in - (void) viewDidUnload, and not in -dealloc? "

+7
source

dealloc. - , Objective-C .

, -.

0

, viewDidUnload "" , dealloc , .

, dealloc, viewDidUnload , .

0

Source: https://habr.com/ru/post/1734418/


All Articles