-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule request: Discarded opaque NSNotificationCenter observer #1062
Comments
Is this still necessary with the automatic unobserving in iOS 9 and later? |
Yes, because that only works when using the selector-based methods. |
Guys, what do you think about this research https://oleb.net/blog/2018/01/notificationcenter-removeobserver/ ? |
@marcelofabri That's not how I interpret the documentation
The first sentence implies after iOS 9.0 you don't need to explicitly unregister the observer no matter the method used. Where did you learn that automatic unregister only works for selector-based methods? |
@daltyboy11 It's trivially confirmable experimentally, as done in the blog post linked just above you by @bimawa. The documentation for
|
From http://fauxpasapp.com/rules/#rule-DiscardedOpaqueNotificationObserver:
Warns if the return value of -
[NSNotificationCenter addObserverForName:object:queue:usingBlock:]
is not stored anywhere. This method returns an opaque observer object that is needed in order to stop observing.The text was updated successfully, but these errors were encountered: