November 2013
Beginner
325 pages
9h 47m
English
Inherent in any of these callback schemes is the risk of strong reference cycles. Often the object you create has a pointer to the object that is going to call back. And it has a pointer to the object you created. If they each have strong references to each other, you end up with a strong reference cycle – neither of them will ever get deallocated.
Figure 27.3 Strong reference cycle
Thus, it was decided that:
Notification centers do not own their observers. If an object is an observer, it will typically remove itself from the notification center in its dealloc method:
- (void)dealloc ...
Read now
Unlock full access