question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RCTCxxModule incorrectly flagged as not exported module by RCTVerifyAllModulesExported

See original GitHub issue

Is this a bug report?

Yes

Have you read the Bugs section of the Contributing to React Native Guide?

Yes

Environment

  1. react-native -v: 0.45.1 / cli 2.0.1
  2. node -v: v7.9.0
  3. npm -v: 5.0.3
  4. yarn --version (if you use Yarn): 0.24.6

Then, specify:

  1. Target Platform: iOS
  2. Development Operating System: macOS Sierra
  3. Build tools: any supported Xcode version, any supported iOS version

Steps to Reproduce

  1. Execute react-native init testproject
  2. Open the Xcode project and hit run

Expected Behavior

No warnings should be logged to the Xcode console since we have the default setup.

Actual Behavior

In the Xcode log there is a warning about the RCTCxxModule not being exported:

2017-07-03 11:09:47.963 [warn][tid:main][RCTBridge.m:114] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2017-07-03 11:09:47.963285+0200 testproject[467:119661] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?

Reproducible Demo

Any newly created React-Native project using the CxxBridge has this issue.

Possible solution

The RCTVerifyAllModulesExported function uses the objc_copyClassList which also reports the RCTCxxModule. This triggers the warning that this module is not exported, but since the RCTCxxModule is merely a base class that can be used by real module implementation this is a false positive.

A possible solution would be to make an exception in RCTVerifyAllModulesExported for the RCTCxxModule so it will not be checked and the warning will not be produced.

Note: The warning will disappear when you create a module that subclasses RCTCxxModule since there is a check in place for that scenario. As long as there is no subclass yet this warning will pop up.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:66
  • Comments:28 (2 by maintainers)

github_iconTop GitHub Comments

20reactions
hobo214commented, Apr 22, 2018

this issue puzzle me a lot. My project ran smoothly days before, however this issue happens today, and this issue appears in every project inited by react-native-cli without any modification .

11reactions
warrenronsiekcommented, Jan 3, 2018

I solved this by making sure that NSAppTrasnportSecurity key in my info.plist had the correct values:

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
	<key>NSAllowsArbitraryLoadsInWebContent</key>
	<true/>
	<key>NSAllowsLocalNetworking</key>
	<true/>
	<key>NSExceptionDomains</key>
	<dict/>
</dict>
Read more comments on GitHub >

github_iconTop Results From Across the Web

warrenronsiek - Profile - Bountysource
warrenronsiek commented on this issueRCTCxxModule incorrectly flagged as not exported module by RCTVerifyAllModulesExported. Facebook 4 years ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found