[Bridge] RCTBridgeModuleClassesByModuleID is tripped up on KVO
In the RCT_DEBUG block of this function, it's attempting to do a scan across all classes for registered classes. If a class has been exported to React but is also being used for KVO, the KVO system automatically adds a "NSKVONotifying_" prefixed subclass as well. For example, exporting a "FooBar" class for which I end up observing will produce a "NSKVONotifying_FooBar" subclass as well. Both will conform to the RCTBridgeModule protocol. The "NSKVONotifying_FooBar" class is not really exported, but RCTBridgeModuleClassesByModuleID questions whether it should be.
It looks like this part of the function is not long-lived. The one issue is this is logged using the error level which causes a red box on typical install and run. Perhaps, this could be dropped to a warn? The other option is to spend time trying to make the code smarter about detecting this situation. I'm not sure if it's worth it for short-lived code though.
~~Once https://github.com/facebook/react-native/pull/1583 is merged,~~ can you see if this issue is present on master? One of the commits in that PR changes the native module registration to use +[load] which the KVO support subclasses shouldn't invoke.
With v0.6.0-rc, I still see it.
To reproduce, perform the following prior to instantiation of the bridge: RCTDatePickerManager *test = [[RCTDatePickerManager alloc] init]; [test addObserver:self forKeyPath:@"bridge" options:(NSKeyValueObservingOptionNew) context:nil];
The patch that changes module loading is planned to go out Friday with 0.7.0-RC.
Looks like this was fixed with .70. @brentvatne already solved