LoginSignup
1
0

More than 5 years have passed since last update.

NSNotificationCenterのremoveObserverをした時にCannot remove an observer for the key path ... because it is not registered as an observerのエラーがでる

Posted at

removeObserverした時に以下のログが出力されるようになった。
前までは出なかったような…?

Cannot remove an observer for the key path "xxxxNotification" from because it is not registered as an observer

Appleの公式ドキュメントに以下の記述あり。

In OS X 10.11 and iOS 9.0 NSNotificationCenter and NSDistributedNotificationCenter will no longer send notifications to registered observers that may be deallocated.

今まではきちんとaddObserverした場合はremoveObserverしないといけなかったけれど、iOS9.0以降は報告先のオブジェクトが解放されていたらNotificationはしないらしい。

つまりremoveObserverしなくていいということらしいです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0