[英]iOS React Native - The operation couldn’t be completed. No such file or directory
Since yesterday I cannot test my React-Native Apps anymore (not on simulator nor on device). 从昨天开始,我不能再测试我的React-Native应用程序了(不在模拟器或设备上)。 I did uninstall Xcode and re-install. 我确实卸载了Xcode并重新安装。 I am testing now with a init AwesomeProject
file. 我现在正在使用init AwesomeProject
文件进行测试。 Xcode reports "Build Successful" and starts displaying the Launch Screen but then I receive the following message Xcode报告“构建成功”并开始显示启动屏幕,但是随后我收到以下消息
"[error][tid:main] The operation couldn't be completed. No such file or directory" “ [错误] [tid:main]无法完成该操作。没有这样的文件或目录”
and the Simulator includes message 并且模拟器包含消息
"RCTFatal" and "RCTBatchedBridge stopLoadingWithError" “ RCTFatal”和“ RCTBatchedBridge stopLoadingWithError”
etc and looks like this: Screenshot of ErrorMessage 等,看起来像这样: ErrorMessage的屏幕截图
Important : I was able to build a clean iOS only Test App whose Build did run successfully. 重要提示 :我能够构建一个干净的仅限iOS的Test App,其Build运行成功。
I also experienced this issue and I think it is the same as is discussed on https://github.com/facebook/react-native/issues/3174 , where the problem concerns IPv4/IPv6. 我也遇到了这个问题,我认为它与https://github.com/facebook/react-native/issues/3174上讨论的问题相同,该问题涉及IPv4 / IPv6。
What worked for me: I put an IPv6 address in AppDelegate.m
. 对我AppDelegate.m
东西:我在AppDelegate.m
放置了一个IPv6地址。 This worked for the simulator (iOS 8.4/9.0/9.1) and device (iPhone, iOS 9.1): 这适用于模拟器(iOS 8.4 / 9.0 / 9.1) 和设备(iPhone,iOS 9.1):
ifconfig | grep inet6 | grep -v fe80::
您可以通过以下方式获取IPv6地址: ifconfig | grep inet6 | grep -v fe80::
ifconfig | grep inet6 | grep -v fe80::
AppDelegate.m
surround it with brackets, so that: 在AppDelegate.m
其用方括号括起来,以便: jsCodeLocation = [NSURL URLWithString:@"http://[abab:1234:1234:abab:aaaa:bbbb:1111:2222]:8081/index.ios.bundle?platform=ios&dev=true"];
A more detailed story, concerning IPv4/6 addresses in AppDelegate.m
: 有关AppDelegate.m
IPv4 / 6地址的更详细的故事:
localhost
does IPv4不起作用,但是主机名(例如localhost
起作用 In your AppDelegate.m file, check the following line 在您的AppDelegate.m文件中,检查以下行
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
If the path is not set to localhost , the emulator won't work. 如果路径未设置为localhost ,则仿真器将无法工作。 If you want to run the app in your phone, have your IP address instead of localhost. 如果要在手机中运行该应用程序,请输入IP地址而不是localhost。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.