Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
607 views
in Technique[技术] by (71.8m points)

objective c - In ARC do we need to send removeObserver: explicitly?

Do we have to send removeObserver: explicitly for objects that have been added as observers to an NSNotificationCenter before?

I am bit confused and unable to find the exact answer for this.

Please provide me in detail, about this including why we need to removeObserver explicitly, and why don't compiler put it implicitly in class/application?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes, you need to call removeObserver:, if you don't the observed class could call all deallocated instance of the observer.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...