ios - React Native 中的 Release模式诊断

标签 ios react-native

有没有办法让 React Native 将所有 console.log 调用输出到同一个地方 NSLog 去?

有没有一种方法可以在 Release 模式下查看 console.log 的输出?

如果没有,我可以使用 NSLog 助手来响应 native 吗?

(请注意,我知道在 Debug模式下我有多种获取此信息的方法,但我遇到了需要诊断的 Release模式的特定问题。)

最佳答案

AppDelegate.m

#import <React/RCTLog.h>

然后在didFinishLaunchingWithOptions

RCTSetLogThreshold(RCTLogLevelInfo - 1);

这会将 react 记录器设置为将所有级别记录到 NSLog 而不是发布默认值:RCTLogLevelError 我猜是 console.error :)

这允许您拥有一个完全诚实的“发布”模式构建,其中包含您想要的所有详细日志记录。

关于ios - React Native 中的 Release模式诊断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39089772/

相关文章:

ios - Phonegap应用程序的内容安全策略

javascript - React-native:按下其他复选框时重置复选框状态

react-native - 无法解析模块(Expo、React Native)

ios - 无法将类型 'P?' 的返回表达式转换为返回类型 'UIViewController'

iphone - 不断更新 UITableView 页脚中的时间?

android - React native 构建开始失败,因为 Gradle 找不到 Could not find play-services-basement

ios - 如何在 React Native 中从终端启用调试器/热重新加载/实时重新加载?

xcode - 为什么我会收到此错误 : 'import of module appears within namespace' on xcode with react-native?

ios - 当我尝试运行相机编码时,当前不支持多个音频/视频 AVCaptureInputs

android - 混合移动应用安全