xcode iOS 构建在编译时失败,问题是“无法为 SimDeviceType 类型找到合适的设备”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42823160/
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-09-15 09:50:27  来源:igfitidea点击:

iOS Build Failed at compile time with issue "failed to find a suitable device for the type SimDeviceType"

iosxcodecompilation

提问by Rein rPavi

I am getting following compile time issue when running the app with Xcode 10.3 beta 2 on iPad Air, I am getting the below issue.

我在 iPad Air 上使用 Xcode 10.3 beta 2 运行应用程序时遇到以下编译时间问题,我遇到以下问题。

Failed to find a suitable device for the type SimDeviceType : com.apple.dt.Xcode.IBSimDeviceType.iPad-2x with runtime SimRuntime : 10.3 (14E5239d) - com.apple.CoreSimulator.SimRuntime.iOS-10-3

Any help is greatly appreciated.

任何帮助是极大的赞赏。

回答by ulsc

It seemes like the old simulator process remained open in the background during an XCode update.

在 XCode 更新期间,旧的模拟器进程似乎在后台保持打开状态。

Simply running

简单地运行

sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService

sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService

in terminal may solve the problem.
There shouldn't be a need for cleaning the project and/or build folder.

在终端可能会解决问题。
不需要清理项目和/或构建文件夹。

回答by Mayur Tanna

If you quit Xcode and still get the same error, then try clean (command + shift + option + k) and select option "Clean" in popup. Repeat this 2 to 3 times. It works in my case.

如果您退出 Xcode 并仍然遇到相同的错误,请尝试 clean (command + shift + option + k) 并在弹出窗口中选择选项“Clean”。重复此操作 2 到 3 次。它适用于我的情况。

回答by Eric G

I was experiencing the same problem. In my case, I had launched the Simulator from a previous version of Xcode prior to building. The problem persisted when I quit the simulator, but restarting Xcode solved it for me.

我遇到了同样的问题。就我而言,我在构建之前从先前版本的 Xcode 启动了模拟器。当我退出模拟器时问题仍然存在,但重新启动 Xcode 为我解决了它。

回答by BonanzaDriver

I just ran into the same issue on the latest Xcode 10.3 (10G8). Had to perform about 4 or 5 full project cleans, and bounce the box, before I could compile again. I wish Apple would get this fixed.

我刚刚在最新的 Xcode 10.3 (10G8) 上遇到了同样的问题。在我可以再次编译之前,必须执行大约 4 或 5 次完整的项目清理,并弹跳盒子。我希望苹果能解决这个问题。

回答by Tiago

I simply had to disconnect the iPad I had connected to my Mac. For some reason that was messing with the way Xcode was compiling.

我只需要断开连接到 Mac 的 iPad。出于某种原因,这扰乱了 Xcode 的编译方式。

回答by Rashwan L

The only thing that solved it for me was the following:

唯一为我解决了以下问题:

  1. Clear the ~/Library/Developer/CoreSimulator/Profiles/Runtimesfolder
  2. Restart Xcode
  3. Clear the project
  4. Run the project
  1. 清除~/Library/Developer/CoreSimulator/Profiles/Runtimes文件夹
  2. 重启Xcode
  3. 清除项目
  4. 运行项目

回答by Randall Wang

I solve this by launching the simulator first, Xcode will pass the build.

我通过首先启动模拟器来解决这个问题,Xcode 将通过构建。

then run the project on the device.

然后在设备上运行项目。

hope this will help

希望这会有所帮助

回答by Marquis103

If you are running multiple versions of xcode, you should check xcode-select -pto ensure you are using the correct version of xcode and compiler. If not, use xcode-select -s { correct xcode path }to set the correct version of xcode.

如果您正在运行多个版本的 xcode,您应该检查xcode-select -p以确保您使用的是正确版本的 xcode 和编译器。如果没有,请使用xcode-select -s { correct xcode path }设置正确版本的 xcode。

回答by Rawan-25

Getting same issue but after an hour getting success to fix this issue there is xcode problem. So please reopen your xcode and then clean your project.. or use short cut command for clear (command + shift + option + k)

遇到同样的问题,但在一个小时后成功解决此问题后,出现了 xcode 问题。所以请重新打开您的 xcode,然后清理您的项目.. 或使用快捷命令清除(命令 + shift + 选项 + k)