从昨天开始,我再也无法测试我的React-Native Apps(不在模拟器上或设备上)。我确实卸载了Xcode并重新安装。我现在正在使用init AwesomeProject
文件进行测试。 Xcode报告"建立成功"并开始显示启动屏幕但我收到以下消息
" [错误] [tid:main]无法完成操作。没有这样的文件或目录"
并且模拟器包含消息
" RCTFatal"和" RCTBatchedBridge stopLoadingWithError"
等 看起来像这样: Screenshot of ErrorMessage
重要:我能够构建一个干净的仅限iOS的测试应用程序,其Build已成功运行。
答案 0 :(得分:1)
我也遇到过这个问题,我认为它与https://github.com/facebook/react-native/issues/3174讨论的问题相同,问题涉及IPv4 / IPv6。
对我有用:我在AppDelegate.m
中放置了一个IPv6地址。这适用于模拟器(iOS 8.4 / 9.0 / 9.1)和设备(iPhone,iOS 9.1):
ifconfig | grep inet6 | grep -v fe80::
AppDelegate.m
中用括号括起来,以便:jsCodeLocation = [NSURL URLWithString:@"http://[abab:1234:1234:abab:aaaa:bbbb:1111:2222]:8081/index.ios.bundle?platform=ios&dev=true"];
关于AppDelegate.m
中的IPv4 / 6地址的更详细的故事:
localhost
等主机名答案 1 :(得分:0)
在AppDelegate.m文件中,检查以下行
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
如果路径未设置为 localhost ,则模拟器无法正常工作。如果您想在手机中运行应用程序,请使用您的IP地址而不是localhost。