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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39722524/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 10:22:54  来源:igfitidea点击:

Xcode 8 | iOS 10 simulator "Error returned in reply: Connection invalid"

iosxcodeios-simulatorios10xcode8

提问by Ketan P

While I am try to run an app in the iOS 10 simulatorusing xcode8I get these alerts frequently. They randomly appear two at a time and it is not apparent what is triggering them.

当我尝试使用iOS 10 模拟器运行应用程序时,xcode8我经常收到这些警报。它们一次随机出现两个,目前尚不清楚是什么触发了它们。

Below is Image for Error I got.

下面是我得到的错误图像。

Error Screen shot.

错误屏幕截图。

I tried Following things.

我试过以下事情。

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

采纳答案by Ketan P

Even I was getting the same error. Issue in my case was I was working on xcode 7.3and its simulator was open, later on I closed xcode 7and opened xcode 8and tried running app and got the above error.

甚至我也遇到了同样的错误。我的问题是我正在使用xcode 7.3并且它的模拟器是打开的,后来我关闭了xcode 7并打开了xcode 8并尝试运行应用程序并得到上述错误。

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 8was trying to establish connection with simulator.

我猜它的发生是因为两个模拟器都打开了,当我关闭我的旧模拟器时它得到了解决。xcode 8尝试与模拟器建立连接时似乎有些问题。

回答by Gangireddy Rami Reddy

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

enter image description here

在此处输入图片说明

v)Go to Location enter image description herevi) Set proper version for command line tools (your Xcode version)

v) 转到位置在此处输入图片说明vi) 为命令行工具设置正确的版本(您的 Xcode 版本)

vii)click on Derived Data enter image description here

vii) 单击派生数据 在此处输入图片说明

viii)Then go to Derived data and delete that folder. see below image enter image description here

viii) 然后转到派生数据并删除该文件夹。见下图 在此处输入图片说明

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 并运行它。

回答by Malder

Without deleting "Derived data" folder

不删除“派生数据”文件夹

The same rules as in the past apply to switching between Xcode 8 and Xcode 9:

  1. Quit Xcode, Instruments, Simulator.app, and Console
  2. xcode-select the version you want to work with
  3. Start the version of Xcode you want to use

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".

与过去相同的规则适用于在 Xcode 8 和 Xcode 9 之间切换:

  1. 退出 Xcode、Instruments、Simulator.app 和 Console
  2. xcode-选择要使用的版本
  3. 启动你要使用的 Xcode 版本

如果这些步骤不能为您解决问题,您可以重复上述步骤 > 但在 #2 之后添加“sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService”。

from this https://forums.developer.apple.com/thread/79301

从这个https://forums.developer.apple.com/thread/79301

回答by Sagar Daundkar

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.

删除派生数据。

回答by Ryan

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. 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.

由于使用 SimPholders 并将 XCode 命令行工具设置为不同版本的 XCode,我遇到了类似的问题,尽管没有启动模拟器的第二个实例。要解决此问题,请打开 XCode 首选项,并在“位置”选项卡下确保命令行工具版本与您当前使用的 XCode 版本相匹配。

回答by user1244109

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. After that all worked fine.

我没有选择模拟器并点击“运行”,而是通过首先打开模拟器表单“打开开发人员工具”菜单来解决它。之后一切正常。

enter image description here

在此处输入图片说明

回答by Jayprakash Dubey

I had the similar issue shown in below screenshot.

我在下面的屏幕截图中显示了类似的问题。

Screenshot 1

截图 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 模拟器状态的屏幕截图。

Screenshot 2

截图 2

回答by BaoDen

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 => 选择文件 => 打开最近的。

回答by Arjun Patel

Force Quit.. Xcodeand simulator. This kind of issue happned because maybe you are try to run more than one different version Xcode at same time.

强制退出.. Xcode和模拟器。发生这种问题是因为您可能尝试同时运行多个不同版本的 Xcode。

回答by user3499381

Changing the device seems to have worked for me after doing the other stuff. Didn't have to restart my computer.

在完成其他工作后,更改设备似乎对我有用。不必重新启动我的电脑。