I have a table view controller whose cells display the content of a different object. Since the content of these objects can be updated, I use KVO to be notified of changes in order to update the table cell view.
Now on this page Apple notes that:
The key-value observing
addObserver:forKeyPath:options:context:
method does not retain the observing object or the observed objects. You need to review your application’s requirements and manage retain and release for the observing, and observed, objects.
Could someone tell me what would happen if the view controller is destroyed and I haven't called r开发者_Python百科emoveObserver:forKeyPath:
on each of the observed objects? Will this cause a bad access or will the framework not send the notification?
You will get a bad access error. Better to remove your controller from observers.
精彩评论