Hai Feng Kao
Hai Feng Kao

Reputation: 5298

UIWebViewDelegate manual release in ARC?

UIWebViewDelegate Protocol Reference states that:

Before releasing an instance of UIWebView for which you have set a delegate, you must first set the UIWebView delegate property to nil before disposing of the UIWebView instance. This can be done, for example, in the dealloc method where you dispose of the UIWebView.

is it still necessary in ARC?

Upvotes: 4

Views: 860

Answers (1)

Stavash
Stavash

Reputation: 14304

If the delegate is defined as a WEAK property, nilling the delegate out is unnecessary as ARC will do this for you. However, if the class is not compiled with ARC and the delegate is marked with "assign", you must take care and set it to nil yourself.

Upvotes: 4

Related Questions