When should I remove observers? Error about deallocating objects before removing observers

后端 未结 4 522
清歌不尽
清歌不尽 2020-12-13 02:18

I am trying to use key-value observing in one of my classes. I register the observers in the init method and remove/deregister them in the dealloc, but I get the following e

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 03:03

    Are you calling [super dealloc] before you remove your observers? Calling super's dealloc too early could lead to an error like this.

提交回复
热议问题