美文网首页
React Native 真机运行报错

React Native 真机运行报错

作者: 默默的前行 | 来源:发表于2017-03-29 16:46 被阅读174次

最近研究React Native,在真机运行遇到 Command /bin/sh failed with exit code 1 的错误, 模拟器运行没有任何问题。此问题已解决,这里分享下解决方案。

kpg.png

主要是划线的部分:

1.PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images ……
2.Command /bin/sh failed with exit code 1

解决方法:

1.选中项目 -> TARGETS->Build Phases-> “Bundle React Native code and images”
2.勾选 “Run script only when installing” ,如下图:

tu2.png

3.Clean 项目,重新运行即可。

程序运行崩溃报错:'bundleURL must be non-nil when not implementing loadSourceForBridge'

1.replace
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"APP/index.ios" fallbackResource:nil];
with
jsCodeLocation=[NSURL URLWithString:@"http://自己电脑的IP:8081/index.ios.bundle?platform=ios&dev=true"];

相关文章

网友评论

      本文标题:React Native 真机运行报错

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