Remove unneeded NSNotification center removeObserver

Summary:
A very common pattern I've seen in RN codebase:

     - (instancetype) init {
        [[NSNotificationCenter defaultCenter] addObserver:self ...]
      }

    - (void) dealloc {
       [[NSNotificationCenter defaultCenter] removeObserver:self ...]
     }

From Apple:

https://developer.apple.com/documentation/foundation/nsnotificationcenter/1413994-removeobserver?language=objc

> If your app targets iOS 9.0 and later or macOS 10.11 and later, you don't need to unregister an observer in its dealloc method.

RN targets iOS9+

Changelog: [Internal][Cleanup] Remove unneeded NSNotification center removeObserver

Reviewed By: shergin

Differential Revision: D18264235

fbshipit-source-id: 684e5f5555cec96b055b13cd83daaeb393f4fac9
This commit is contained in:
Peter Argany
2019-11-04 10:19:30 -08:00
committed by Facebook Github Bot
parent 56c7ae729a
commit dc3b5ad275
25 changed files with 5 additions and 99 deletions
@@ -95,11 +95,6 @@ RCT_EXPORT_SHADOW_PROPERTY(onContentSizeChange, RCTBubblingEventBlock)
lazilyLoadIfNecessary:YES]];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - RCTUIManagerObserver
- (void)uiManagerWillPerformMounting:(__unused RCTUIManager *)uiManager