Shivam Khandelwal
Shivam Khandelwal

Reputation: 31

Native module cannot be null

enter image description here

On running the react- native app for iOS, the emulator opened up with this screen. On searching for the problem, I found that there were no solutions to it provided by people, please help.

Earlier, i got a problem that the simulator was not even loading, and the build was failing with this error:

The following build commands failed:

CompileC /Users/mi0205/AwesomeProject/ios/build/Build/Intermediates/RCTWebSocket.build/Debug-iphonesimulator/RCTWebSocket.build/Objects-normal/x86_64/RCTSRWebSocket.o RCTSRWebSocket.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
/Users/mi0205/AwesomeProject/node_modules/promise/lib/done.js:10
  throw err;

On reading a bit, I came to know that deleting the RCTWebSocket scode project file will lead to successful build, so I did that, but this problem came up thereafter

Upvotes: 3

Views: 2979

Answers (1)

Stefan
Stefan

Reputation: 251

I got the same message after trying to use fetch. Took my a while to realize that I needed the 'RCTNetwork' pod added to the subspecs in my Podfile:

target 'MyProject' do
    # Uncomment this line if you're using Swift or would like to use dynamic frameworks
    # use_frameworks!

    # Pods for MyProject
          pod 'React', :path => '../my-project/node_modules/react-native', :subspecs => [
          'Core',
          'RCTText',
          'RCTNetwork',
          'RCTWebSocket', # needed for debugging
          # Add any other subspecs you want to use in your project
     ]
end

More information here: https://facebook.github.io/react-native/docs/integration-with-existing-apps.html

Upvotes: 1

Related Questions