React-Native:模块RCTLog不是已注册的可调用模块
问题描述:
在React-Native 0.29和0.30中。
当我使用脱机捆绑包iOS设备上运行时,总是得到下面的错误信息:React-Native:模块RCTLog不是已注册的可调用模块
未处理JS例外:模块RCTLog不是已注册的可调用的模块。
RCTFatal + 124
- [RCTExceptionsManager reportFatalException:堆栈:exceptionId:] + 584
+ 144
+ 296
+ 68
- [RCTModuleMethod invokeWithBridge:模块:参数:] + 1684
- [RCTBatchedBridge _handleRequestNumber :的moduleId:放在methodID:PARAMS:] + 712
__33- [RCTBatchedBridge handleBuffer:] _ block_invoke.452 + 1144
...
捆绑有:
react-native bundle --entry-file ./index.ios.js --platform ios --dev false --bundle-output ./Example/index.ios.jsbundle --assets-dest ./Example/ --verbose
剂量任何人得到同样的问题,我该如何解决它,Thx。
答
您是否在index.ios.js文件中导入了React?
答
添加var RCTLog = require('RCTLog');
到index.ios.js
它实际上一个错误https://github.com/facebook/react-native/issues/8663
是,进口它。当我运行时,一切都很好 –
是的,导入它。使用在线捆绑软件运行时,一切正常,但不在脱机捆绑中。 –
@EchoCheng同样的问题在这里你得到了解决 – Saleeh