How to set Debug or Release mode in React Native for iOS (Xcode) like we used to do in Build Setting->LLVM Preprocessor over Native code? Is there any way or do I need to specify in JS code itself? If there is no way then how should we access the property set by Xcode in React Native JS Code?
Asked
Active
Viewed 1.5k times
1 Answers
17
Set debug or release mode:
For iOS open your project in Xcode and select Product → Scheme → Edit Scheme... (or press ⌘ + <). Next, select Run from the menu on the left and change the Build Configuration to Release.
For Android, by default, developer menu will be disabled in release builds done by gradle (e.g with gradle assembleRelease task). Although this behavior can be customized by passing proper value to ReactInstanceManager#setUseDeveloperSupport.
Source: https://facebook.github.io/react-native/docs/debugging.html
Access the information if you are in debug or release mode with:
if (__DEV__) {
console.log('I am in debug');
}
Source: How can I determine if my React Native app is a debug or release build from JavaScript code?
-
It still doesn't work. I'm always getting Debug even after running the product in release – shubhsin Jul 08 '16 at 07:36
-
This gives me build errors in RCTNetwork and other React libraries about things like `RCTLog.h` and `RCTBridgeModule.h` being missing. I'm guessing it somehow doesn't include those in release mode, but some things still depend on them. – sudo Jul 08 '18 at 21:04