React Native 真机运行报错

最近研究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"];

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容