简体   繁体   English

iOS React Native-操作无法完成。 没有相应的文件和目录

[英]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):

  • you get your IPv6 address with: ifconfig | grep inet6 | grep -v fe80:: 您可以通过以下方式获取IPv6地址: ifconfig | grep inet6 | grep -v fe80:: ifconfig | grep inet6 | grep -v fe80::
  • in 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地址的更详细的故事:

  • in simulator: 在模拟器中:
    • iOS 9.0 and 9.1: iOS 9.0和9.1:
      • IPv4 doesn't work, however a hostname such as localhost does IPv4不起作用,但是主机名(例如localhost起作用
      • IPv6 works IPv6的作品
    • iOS 8.4: iOS 8.4:
      • IPv4 and IPv6 work IPv4和IPv6的工作
  • on device, iPhone with iOS 9.1: 在装有iOS 9.1的iPhone上:
    • IPv4 actually does work for me IPv4实际上对我有用
    • IPv6 also works IPv6也可以

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.

相关问题 react-native-share 操作无法完成。 未安装 - react-native-share The operation couldn’t be completed. Not installed iOS 6 Facebook“操作无法完成。” - iOS 6 Facebook 'The operation couldn’t be completed.' iOS 6 Facebook“操作无法完成。” - iOS 6 Facebook 'The operation couldn't be completed.' 无法加载React Native Image-操作无法完成。 (NSURLErrorDomain错误-1005。) - React Native Image not loading- The operation couldn’t be completed. (NSURLErrorDomain error -1005.) Error Domain = NSCocoaErrorDomain代码= 512“该操作无法完成。该操作无法完成。是一个目录 - Error Domain=NSCocoaErrorDomain Code=512 "The operation couldn’t be completed.The operation couldn’t be completed. Is a directory kCLErrorDomain Code=8 "操作无法完成。 - kCLErrorDomain Code=8 "The operation couldn’t be completed. writeToFile给NSUnderlyingError = 0x6a3d450“该操作无法完成。 是目录” - writeToFile gives NSUnderlyingError=0x6a3d450 “The operation couldn’t be completed. Is a directory” 如何修复“无法加载资源:操作无法完成。 iOS 12 视频中的协议错误? - How to fix 'Failed to load resource: The operation couldn't be completed. Protocol Error" in iOS 12 Video? 如何修复损坏的iOS模拟器(操作无法完成。LaunchServicesError错误0。) - How to fix a broken iOS Simulator (The operation couldn’t be completed. LaunchServicesError error 0.) iOS的Facebook登录错误:操作无法完成。 (com.facebook.sdk.core错误3。) - Facebook login for iOS error: The operation couldn’t be completed. (com.facebook.sdk.core error 3.)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM