if you tell an objective c object to removeObservers: for a key path and that key path has not been registered, it cracks the sads. like -
\'Cannot remove an observe
In addition to Adam's answer I would like to suggest to use macro like this
#define SafeRemoveObserver(sender, observer, keyPath) \
@try{\
[sender removeObserver:observer forKeyPath:keyPath];\
}@catch(id anException){\
}
example of usage
- (void)dealloc {
SafeRemoveObserver(someObject, self, somePath);
}