Application crashing only in release mode, how to debug this kind of problem?See original GitHub issue
- [Yes ] I have reviewed the documentation
- [Yes ] I have searched existing issues
- [Yes ] I am using the latest React Native version
Environment: OS: macOS High Sierra 10.13 Node: 9.10.1 Yarn: Not Found npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: ^16.3.0 => 16.3.0 react-native: ^0.55.0 => 0.55.0
Steps to Reproduce
Follow the steps in https://facebook.github.io/react-native/docs/running-on-device.html, Building your app for production. Run a release build. Open Xcode. Go to edit schemes. Change the Run build configuration from Debug to Release. Or you can run it from terminal: react-native run-ios --configuration Release
JS bundle completes launch and app doesn’t crash.
App crashes when the JS bundle loads. Here is the crash log:
*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Cannot call a class as a function', reason: 'Unhandled JS Exception: Cannot call a class as a function, stack: classCallCheck@11:648 t@306:876 run@279:617 runApplication@279:2046 value@18:3471 <unknown>@18:956 value@18:2898 value@18:928
My application works fine on release for Android, and also works fine in debug mode on iOS, the problem only appears on iOS release mode. How should i debug problems in release mode? I Tried to reident and look at the lines of code suggested on the error message in the main.jsbundle, but i haven’t been able to find the source of the problem anyway.
I tried everything i found on the issues #18647 #16567 and in similar issues. My application code is huge so i cant check every react class to find the problem(although i tried). Should i try to reinstall all my dependencies from zero until i find what is causing the problem? It seems like react native have absolutely no support for this kind of release bugs problem from the other issues i have seen.
- Created 5 years ago
Top GitHub Comments
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?
Thank you for your contributions.
after 5 days looking for the issue i found out the problem was that my index.ios.js was calling my main class like this
AppRegistry.registerComponent('App', App);when it actually should have been like this
AppRegistry.registerComponent('App', () => App);
For anyone that got stuck in release bugs like me try installing the haul library https://github.com/callstack/haul, it still has many bugs, but it gives much better error messages then the react native core. Debugging this problem would be impossible if i had not found haul.