我正在addObserver:selector:name:object:使用viewDidLoad。
我正在使用removeObserver:name:object:inviewWillDisappear:animated:删除观察者。
如果我通过传递错误的参数来删除观察者失败会发生什么removeObserver:name:object:?
(例如,如果我将错误的通知传递给参数name或将错误的对象传递给objector ,则不会删除观察者Observer)
如果调用后观察者仍然不为零removeObserver:name:object:,我可以发现删除观察者失败,因为将调用 notificationSelector。
但是如果观察者在调用后变为 nil removeObserver:name:object:,我无法确定删除观察者是否失败。
当观察者为零时,观察者会自动移除吗?
还是notification dispatch tableofNSNotificationCenter变得越来越大,最终应用程序变慢了?
编辑
当我使用 UIViewController 对象的子类作为观察者时,调用 ViewController 后应用程序不会崩溃dealloc。
但是当我使用其他类的对象时,应用程序在对象dealloc被调用后崩溃。