简体   繁体   English

Xcode 8 | iOS 10模拟器“回复时返回错误:连接无效”

[英]Xcode 8 | iOS 10 simulator “Error returned in reply: Connection invalid”

While I am try to run an app in the iOS 10 simulator using xcode8 I get these alerts frequently. 当我尝试使用xcode8iOS 10模拟器中运行应用程序时,我经常收到这些警报。 They randomly appear two at a time and it is not apparent what is triggering them. 它们一次随机出现两个,并且不明显是什么触发它们。

Below is Image for Error I got. 下面是我得到的错误图片。

错误屏幕截图。

I tried Following things. 我试过以下事情。

  • Clean & Rebuild an app 清理并重建应用程序
  • Restart xcode & Simulator 重启xcode和模拟器
  • Clear Derived Data & Rebuild application. 清除派生数据和重建应用程序。

Even I was getting the same error. 即使我得到了同样的错误。 Issue in my case was I was working on xcode 7.3 and its simulator was open, later on I closed xcode 7 and opened xcode 8 and tried running app and got the above error. 在我的情况下问题是我正在研究xcode 7.3并且它的模拟器是打开的,稍后我关闭xcode 7并打开xcode 8并尝试运行app并得到上述错误。

I guess its happening because of both the simulator were open, it got solved when I closed my older simulator. 我猜它的发生是因为模拟器都打开了,当我关闭我的旧模拟器时它就解决了。 Seem to be some problem while xcode 8 was trying to establish connection with simulator. xcode 8试图与模拟器建立连接时,似乎有些问题。

You just follow these steps to remove this error it's working fine in my side and i hope these steps work to you also just try it. 您只需按照以下步骤删除此错误即可在我身边正常工作,我希望这些步骤对您有用,也可以尝试一下。

 i)Remove multiple xcode versions.
ii)Quit all Xcode and simulators. 
iii)Only one version you opened.
iv)Go to Xcode  -> Preferences

在此输入图像描述

v)Go to Location v)前往位置 在此输入图像描述 vi) Set proper version for command line tools (your Xcode version) vi)为命令行工具设置正确的版本(您的Xcode版本)

vii)click on Derived Data vii)单击派生数据 在此输入图像描述

viii)Then go to Derived data and delete that folder. viii)然后转到派生数据并删除该文件夹。 see below image 见下图 在此输入图像描述

ix) Click on Simulator reset content settings and just quit xcode and simulator and open clear and build the xcode and run it. ix)点击模拟器重置内容设置,然后退出xcode和模拟器,打开清除并构建xcode并运行它。

Without deleting "Derived data" folder 不删除“派生数据”文件夹

The same rules as in the past apply to switching between Xcode 8 and Xcode 9: 与过去相同的规则适用于在Xcode 8和Xcode 9之间切换:

  1. Quit Xcode, Instruments, Simulator.app, and Console 退出Xcode,Instruments,Simulator.app和Console
  2. xcode-select the version you want to work with xcode - 选择您要使用的版本
  3. Start the version of Xcode you want to use 启动您要使用的Xcode版本

If these steps don't resolve the problem for you, you can repeat the steps above > but after #2 add "sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService". 如果这些步骤无法解决问题,您可以重复上述步骤>但在#2之后添加“sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService”。

from this https://forums.developer.apple.com/thread/79301 来自这个https://forums.developer.apple.com/thread/79301

The Same issue I have faced when I have two Xcode version, but the issue was when we are opening the two instances of simulator we will get the same error, the best way to solve this issue is run command 我有两个Xcode版本时遇到的同样问题,但问题是当我们打开两个模拟器实例时我们会得到同样的错误,解决这个问题的最好方法是运行命令

rm -rf ~/Library/Developer/Xcode/DerivedData 

to remove the derived data. 删除派生数据。

I had a similar issue, despite not launching a second instance of the simulator, due to using SimPholders and having the XCode Command Line Tools set to a different version of XCode. 我有一个类似的问题,尽管没有启动模拟器的第二个实例,因为使用SimPholders并将XCode命令行工具设置为不同版本的XCode。 To resolve this, open up XCode preferences, and under the Locations tab ensure that the Command Line Tools version matches what version of XCode you're currently working in. 要解决此问题,请打开XCode首选项,然后在“位置”选项卡下,确保“命令行工具”版本与您当前使用的XCode版本相匹配。

None of the above worked for me. 以上都不适合我。

Instead of choosing the simulator and hitting "run" i solved it by opening the simulator form "Open Developer Tool" menu first. 我没有选择模拟器并点击“运行”,而是首先通过打开模拟器“Open Developer Tool”菜单来解决它。 After that all worked fine. 之后一切正常。

在此输入图像描述

I had the similar issue shown in below screenshot. 我有类似的问题,如下面的屏幕截图所示。

截图1

Got it solved by closing Xcode 7 and its simulator. 通过关闭Xcode 7及其模拟器解决了这个问题。

It seems that when you are working on Xcode 8 and its simulator then Xcode 7 simulator should not remain open. 看来,当您使用Xcode 8及其模拟器时,Xcode 7模拟器不应该保持打开状态。

Below is screenshot of simulator state for Xcode 7 when you're working on Xcode 8. 下面是您在使用Xcode 8时Xcode 7的模拟器状态的屏幕截图。

截图2

In my case, I was open a project a Xcode 8, and the emulator for this version, then open this project on Xcode 7.3.1, when I create an emulator it shows the alert. 在我的例子中,我打开了一个项目Xcode 8,以及这个版本的模拟器,然后在Xcode 7.3.1上打开这个项目,当我创建一个模拟器它显示警报。

My Solution: Close all version of Xcode => Clear Derived Data => Quit Xcode => Open Xcode => Choose File => Open Recent. 我的解决方案:关闭所有版本的Xcode =>清除派生数据=>退出Xcode =>打开Xcode =>选择文件=>打开最近。

Force Quit.. Xcode and simulator. 强制退出.. Xcode和模拟器。 This kind of issue happned because maybe you are try to run more than one different version Xcode at same time. 这种问题很幸福,因为您可能会尝试同时运行多个不同版本的Xcode。

I just had this issue when attempting to debug an iOS application from Xamarin, which uses Xcode to run apps in the simulator. 我在尝试从Xamarin调试iOS应用程序时遇到了这个问题,Xamarin使用Xcode在模拟器中运行应用程序。 I was initially targeting a 9.7" iPad Pro, attempted to change the simulated device to an iPad Air 2 (still on iOS 10), but the simulator didn't respond. After quitting and relaunching the simulator it appeared to load okay, so I changed back to the previous device - not sure whether changing devices actually did anything but I haven't seen the error message in the few times I've run my app since. 我最初的目标是9.7“iPad Pro,试图将模拟设备更改为iPad Air 2(仍然在iOS 10上),但模拟器没有响应。退出并重新启动模拟器后,它似乎加载好了,所以我改回以前的设备 - 不确定更改设备是否实际做了什么,但我几次没有看到错误消息,因为我已经运行我的应用程序。

Solved it by closing all xcode and simulator. 通过关闭所有xcode和模拟器来解决它。 Don't ask me why. 不要问我为什么。 It was happening on the beta version for me 它发生在我的测试版上

I had similar issue, what I did is I closed the simulator and all the Xcode and I went to the terminal and typed to see any Xcode application running then I killed it. 我有类似的问题,我做的是我关闭了模拟器和所有的Xcode,然后我去了终端并键入以查看运行的任何Xcode应用程序然后我将其杀死。 I had one Xcode running in the background. 我在后台运行了一个Xcode。

Command to see if Xcode is running, 命令查看Xcode是否正在运行,

ps -e | grep -i xcode

Use kill comment to kill any runing Xcode app, I used 使用kill comment来杀死任何正在运行的Xcode应用程序,我用过

kill -9 <pid>

在我的情况下,我遇到了同样的问题我停止了所有应用程序并重新启动了我的mac,一切都很好

Simple And fast Remedies.. 简单快速的补救措施..

1.Quit all xCode and reopen the xCode which you need to work... 1.Quit所有xCode并重新打开你需要工作的xCode ...

I had this problem too, but I did below process it's working fine. 我也有这个问题,但我在下面处理它工作正常。

You have both Xcode 8.xx and 9 running on your Mac, which causes the problem. 您的Mac上运行Xcode 8.xx和9,这会导致问题。 Only run one Xcode at a time (Quit another Xcode, don't let another Xcode runing in background!). 一次只运行一个Xcode(退出另一个Xcode,不要让另一个Xcode在后台运行!)。

This can occur when you have more than one version of Xcode installed on your computer. 当您的计算机上安装了多个版本的Xcode时,可能会发生这种情况。 Make sure you QUIT (not just close) all versions of Xcode first. 确保首先退出(不仅仅是关闭)所有版本的Xcode。

Changing the device seems to have worked for me after doing the other stuff. 在完成其他工作后,更换设备似乎对我有用。 Didn't have to restart my computer. 没有重启我的电脑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM