美文网首页
react native ios在release模式下打印js

react native ios在release模式下打印js

作者: hushicai | 来源:发表于2017-11-29 16:51 被阅读0次

在react native中有这么几种日志:

在debug模式下,react native默认打印trace以上级别日志

在release模式下,react native默认打印error以上级别日志

如果想在release模式下,打印所有console日志,可以在AppDelegate.m中这么干:

1、引入RCTLog头文件

#import <React/RCTLog.h>

2、在application方法中调整日志级别

RCTSetLogThreshold(RCTLogLevelInfo - 1)

然后在mac系统下就可以通过console.app来过滤查看日志:

有了js console日志,调试生产包就方便很多了!

相关文章

网友评论

      本文标题:react native ios在release模式下打印js

      本文链接:https://www.haomeiwen.com/subject/kucpbxtx.html