Skip to content
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

Silence warning "Class RCTCxxModule was not exported" #19794

Closed
wants to merge 1 commit into from

Conversation

chrisballinger
Copy link

On a relatively stock / default setup of RN on iOS you'll see the warning "Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?" pop up on every launch. This change resolves that issue.

Fixes #14806

Test Plan

Try a fresh project by following the RN iOS tutorial, and observe that there are no more warnings after making this change.

Release Notes

[IOS] [MINOR] [CxxBridge] - Fix "Class RCTCxxModule was not exported"

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@douglowder
Copy link
Contributor

@shergin I'm hitting this also... is the fix in this PR ok, or should this class name be filtered out in RCTBridge.m?

e.g.

         if (isModuleSuperClass) {
           break;
         }
+        
+        if (strncmp(class_getName(superclass), "RCTCxxModule", strlen("RCTCxxModule")) == 0) {
+          break;
+        }
 
         RCTLogWarn(@"Class %@ was not exported. Did you forget to use RCT_EXPORT_MODULE()?", cls);
         break;

@javache
Copy link
Member

javache commented Jun 25, 2018

Yes, the module should not be exported. Instead the module should be ignored in RCTVerifyAllModulesExported.

Copy link
Contributor

@douglowder douglowder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisballinger This module should not be exported. See @javache 's comment, and the code snippet I provided that fixes the issue in a safer way.

@douglowder
Copy link
Contributor

@chrisballinger thanks for submitting this PR -- I've implemented the alternative fix requested by @javache in a separate PR and will get that merged as soon as CI passes.

@douglowder douglowder closed this Jun 25, 2018
@chrisballinger
Copy link
Author

@dlowder-salesforce @javache Awesome thanks!

facebook-github-bot pushed a commit that referenced this pull request Jun 27, 2018
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

On a relatively stock / default setup of RN on iOS you'll see the warning "Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?" pop up on every launch. This change resolves that issue.

Fixes #14806 .

This supersedes PR #19794 .

Try a fresh project by following the RN iOS tutorial, and observe that there are no more warnings after making this change.

[IOS] [MINOR] [CxxBridge] - Fix "Class RCTCxxModule was not exported"
Closes #19880

Differential Revision: D8653809

Pulled By: hramos

fbshipit-source-id: c48529c2d74ddd40a90bc0e06e405078e25b72e3
@keshavkaul
Copy link

@chrisballinger @dlowder-salesforce @javache
FYI, I'm seeing this issue in react version 0.56.0-rc.4 released 16 hrs ago.
Is this fix present in the latest RC?

macdoum1 pushed a commit to macdoum1/react-native that referenced this pull request Jun 28, 2018
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

On a relatively stock / default setup of RN on iOS you'll see the warning "Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?" pop up on every launch. This change resolves that issue.

Fixes facebook#14806 .

This supersedes PR facebook#19794 .

Try a fresh project by following the RN iOS tutorial, and observe that there are no more warnings after making this change.

[IOS] [MINOR] [CxxBridge] - Fix "Class RCTCxxModule was not exported"
Closes facebook#19880

Differential Revision: D8653809

Pulled By: hramos

fbshipit-source-id: c48529c2d74ddd40a90bc0e06e405078e25b72e3
hramos pushed a commit that referenced this pull request Jul 4, 2018
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

On a relatively stock / default setup of RN on iOS you'll see the warning "Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?" pop up on every launch. This change resolves that issue.

Fixes #14806 .

This supersedes PR #19794 .

Try a fresh project by following the RN iOS tutorial, and observe that there are no more warnings after making this change.

[IOS] [MINOR] [CxxBridge] - Fix "Class RCTCxxModule was not exported"
Closes #19880

Differential Revision: D8653809

Pulled By: hramos

fbshipit-source-id: c48529c2d74ddd40a90bc0e06e405078e25b72e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RCTCxxModule incorrectly flagged as not exported module by RCTVerifyAllModulesExported
7 participants