Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Debug or Release | React Native - iOS

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?

like image 250
shubhsin Avatar asked Jul 05 '16 11:07

shubhsin


People also ask

How do I run iOS on Windows React Native?

Expo allows us to build for both Android and iOS on Windows, Mac and Linux. You can run your React Native app on a physical device without setting up the development environment. All you need to do is download the Expo Go app, run expo start and then scan the QR code that shows up.


1 Answers

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?

like image 121
Orlando Avatar answered Oct 13 '22 23:10

Orlando