简体   繁体   English

即使__DEV__为false,react-native中的console.error也会抛出红色屏幕

[英]console.error in react-native throws red screen even when __DEV__ is false

I'm building react-native app with Exponent and do some logging with console.error eg when network request fails etc. While it's helpful in development to see this red screen with error on simulator or real device, I'm getting this too when __DEV__ is set to false (seeing it is set so in logs) while the web says it shouldn't work like this. 我正在使用Exponent构建react-native应用程序并使用console.error进行一些日志记录,例如当网络请求失败时等等。虽然在开发中看到这个红色屏幕在模拟器或真实设备上出现错误很有帮助,但我也是这样做的。 __DEV__设置为false (看到它在日志中设置),而网站说它不应该像这样工作。

How can I disable that for non-dev builds? 如何禁用非开发版本? Is there any other way than monkey-patching console.error ? 有没有其他方法比猴子修补console.error

You are getting this fullscreen error until you run your app in production mode. 在生产模式下运行应用程序之前,您将收到此全屏错误。 That means you need to run your iOS/Android app in production. 这意味着您需要在生产中运行iOS / Android应用程序。

If you want to do it with iOS you need to change your Scheme to Release 如果您想使用iOS,则需要将Scheme更改为Release

More details can be found here 更多细节可以在这里找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM