简体   繁体   English

Xcode 项目未显示模拟器列表

[英]Xcode project not showing list of simulators

I open my project in Xcode 6.1.我在 Xcode 6.1 中打开我的项目。 When I try to run the project, the button is grayed out.当我尝试运行该项目时,该按钮显示为灰色。 When I try to go to Product > Clean , the option is grayed out.当我尝试转到Product > Clean时,该选项显示为灰色。 When I look at the list of simulators, all I get is My Mac instead of the usually iOS Device .当我查看模拟器列表时,我得到的只是My Mac而不是通常的iOS Device How do I get my simulators to come back?如何让我的模拟器回来?

Make sure that the project you are trying to run has deployment target equal to or less then the SDK version of your Xcode.确保您尝试运行的项目的deployment target等于或小于 Xcode 的 SDK 版本。 In my case I tried to run a project which was built using iOS8.4 but I have Xcode6.1 with SDK version 8.1在我的情况下,我尝试运行一个使用iOS8.4构建的项目,但我有 Xcode6.1 和 SDK 版本 8.1

I changed the deployment target to 8.1 and it start showing me simulators.我将部署目标更改为 8.1,它开始向我展示模拟器。

PS before doing this, make sure that your code and external libraries are compatible with your new deployment target, else you have to update your Xcode. PS 在执行此操作之前,请确保您的代码和外部库与您的新部署目标兼容,否则您必须更新您的 Xcode。

Try This, It worked like a charm!试试这个,它就像一个魅力! for me,为了我,

Follow below step按照下面的步骤

1) Clean Derived Data as show below, 1)清理派生数据,如下所示,

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

OR

 Xcode---> Preferences--->Location--->Derived Data

派生数据

2) In Deployment Info change Deployment Target 2)在部署信息更改部署目标

It's equal to or less then the SDK version of Xcode等于小于XcodeSDK版本

在此处输入图片说明

3) Quit Xcode 3)退出Xcode

在此处输入图片说明

4) Reopen Xcode you will see list of simulators 4) 重新打开Xcode,您将看到模拟器列表

在此处输入图片说明

Hope this answer will help for someone.希望这个答案对某人有所帮助。

I could not find any solution that would fix my issue.我找不到任何可以解决我的问题的解决方案。 All simulators were there for all projects but the one that I needed them.所有模拟器都适用于所有项目,但我需要它们的那个。

Solution:解决方案:

Build Settings -> Architectures -> Supported Platforms:构建设置 -> 架构 -> 支持的平台:

changed from iphoneos to iOSiphoneos更改为iOS

Click on the project name (Right to the Run button).单击项目名称(运行按钮的右侧)。 Three options will appear.将出现三个选项。

  1. Edit scheme编辑方案
  2. New scheme新方案
  3. Manage scheme管理方案

You can click on "New scheme" and then click on "OK" in popup window.您可以单击“新方案”,然后在弹出窗口中单击“确定”。

You will have simulators list back.您将获得模拟器列表。

Also check the iOS Deployment Target under build settings.还要检查构建设置下的iOS Deployment Target I was using Xcode 6.3 while the deployment target was set to iOS 8.4.我使用的是 Xcode 6.3,而部署目标设置为 iOS 8.4。 I got the list of simulators as soon as I set it to iOS 8.3我一设置为 iOS 8.3 就得到了模拟器列表在此处输入图片说明

Cmd below solved my problem:下面的 Cmd 解决了我的问题:

$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

In my case, I upgraded to Xcode 8 and downloaded another version 7.3.1 later (renamed it to "Xcode 7.3.1"), then cannot get the simulator list in Xcode 8.就我而言,我升级到 Xcode 8 并稍后下载另一个版本 7.3.1(将其重命名为“Xcode 7.3.1”),然后无法在 Xcode 8 中获取模拟器列表。

In my case i'd accidentally deleted ios devices in system Finder -> Library->Devices->Core simulator就我而言,我不小心删除了系统 Finder -> Library->Devices->Core Simulator 中的 ios 设备

So, the simulators are not listed in the Xcode project except ios device.因此,除了 ios 设备之外,Xcode 项目中未列出模拟器。

I solved this by adding ios simuulators from Xcode->Window->Devices->Add simulators我通过从 Xcode->Window->Devices->Add Simulators 添加 ios 模拟器解决了这个问题

在此处输入图片说明

Hope it'll help someone.希望它会帮助某人。

For those coming from Unity, even if you manage to make them show up (by changing Build Settings > Supported Platforms to iOS it would not run in the simulator.对于那些来自 Unity 的人,即使您设法让它们显示出来(通过将Build Settings > Supported Platforms更改为iOS它也不会在模拟器中运行。

Instead, you need to select this Simulator SDK :相反,您需要选择此 Simulator SDK :

在此处输入图片说明

And make sure something other than Metal exist.并确保存在除 Metal 之外的其他东西。

在此处输入图片说明

Then the simulator device list will be there from start.然后模拟器设备列表将从一开始就在那里。

Solution: Build Settings -> Architectures -> Supported Platforms: changed from iphoneos to iOS解决方案:Build Settings -> Architectures -> Supported Platforms:从iphoneos改为iOS

Confirmed works in Xcode Version 9.0 (9A235)确认在 Xcode 版本 9.0 (9A235) 中有效

If you renamed Xcode.app since first launch, the iOS Simulator becomes unavailable.如果您在首次启动后重命名 Xcode.app,iOS 模拟器将不可用。 This is mentioned in the Xcode 6.1 Release Notes :这在Xcode 6.1 发行说明中提到:

Renaming Xcode.app after running any of the Xcode tools in that bundle may cause iOS Simulator to be no longer be available.在运行该包中的任何 Xcode 工具后重命名 Xcode.app 可能会导致 iOS 模拟器不再可用。 Either rename Xcode.app back to what it was when first launched or restart your Mac.将 Xcode.app 重命名为首次启动时的名称或重新启动 Mac。 (16646772) (16646772)

转到窗口,然后转到设备,然后按左下角的加号按钮添加设备并选择所需的模拟器。这对我有用。

检查项目的构建设置,确保选择最新的 iOS (iOS 8.1)。

Sometimes the simulator you have might not be the simulator specified in Build Settings .有时,您拥有的模拟器可能不是Build Settings 中指定的模拟器。 Make sure that simulator package is downloaded for your IOS Deployment Target确保为您的IOS 部署目标下载了模拟器包

If Your problem is due to multiple (versions of) xcode如果您的问题是由多个(版本的)xcode 引起的

Then follow following steps然后按照以下步骤

1. Cleaning Derived Data Go to Xcode preferences -> Select location tab -> select little gray arrow on /Users/apple/Library/Developer/Xcode/DerivedData. 1.清理派生数据转到Xcode首选项->选择位置选项卡->选择/Users/apple/Library/Developer/Xcode/DerivedData上的灰色小箭头。 You will be redirect to folder From there select Derived Data folder and Delete.您将被重定向到文件夹,从那里选择派生数据文件夹并删除。
在此处输入图片说明

2. Completely Quite The Xcode and reopen 2. 完全关闭 Xcode 并重新打开

This will solve your problem.这将解决您的问题。 Happy coding :)快乐编码:)

只需检查XCode支持与否的部署目标

Deployment Target version change to a lower one helped for me:部署目标版本更改为较低版本对我有帮助:

Window -> Devices and Simulators -> Simulators.窗口 -> 设备和模拟器 -> 模拟器。 Check what are the latest versions of existing simulators.检查现有模拟器的最新版本是什么。

模拟器

Then go to your project's Target.然后转到您项目的目标。 Under Deployment Info, change Target to the version you saw the latest within your simulators.在部署信息下,将目标更改为您在模拟器中看到的最新版本。 Mine was set to iOS 13.6 when the simulator was iOS 13.5 only.当模拟器仅为 iOS 13.5 时,我的设置为 iOS 13.6。

部署目标

Looks like Xcode hides that menu when the window is a certain size.当窗口达到一定大小时,Xcode 似乎隐藏了该菜单。 You have to make your window quite large before it comes back.在它回来之前,你必须让你的窗口变得非常大。

Same Problem happened with me.. When I updated from Xcode 8 Beta 3 to Xcode 8 Beta 4, But I resolved it by this way..同样的问题发生在我身上..当我从 Xcode 8 Beta 3 更新到 Xcode 8 Beta 4 时,但我通过这种方式解决了它..

  1. Go to Window -> Devices转到窗口 -> 设备

you can see all Devices and Simulators here你可以在这里看到所有的设备和模拟器

  1. Just right click on any device or simulator只需右键单击任何设备或模拟器
  2. Tick on Show in Destination Menu (Even it is already checked, then click it twice, It may be refresh things)勾选在目标菜单中显示(即使它已经被选中,然后单击它两次,它可能是刷新的东西)

If above does not work.. as if you do not see any simulators, then..如果以上不起作用..就好像您没有看到任何模拟器一样,那么..

  1. Change(degrade) the minimum deployment target of app to 8.3(not necessary)将应用程序的最小部署目标更改(降级)为 8.3(不需要)
  2. restart xcode重启xcode

It worked for me.. Hope will be helpful for someone later..它对我有用..希望以后会对某人有所帮助..

I still had my iOS Device , but all my simulators were gone.我还有我的iOS Device ,但我所有的模拟器都不见了。

I tried every suggested solution I could find on stackoverflow.我尝试了我可以在 stackoverflow 上找到的所有建议的解决方案。

Eventually, I deleted the Xcode app and downloaded it again from the App Store.最后,我删除了 Xcode 应用程序并从 App Store重新下载 After installation, the simulators were back.安装后,模拟器又回来了。

Quite Xcode and Open it again, it will show.相当 Xcode 并再次打开它,它会显示。 For me it's worked.对我来说它奏效了。

Small but a effective solution.小而有效的解决方案。 In my case i updated to my xcode to 9.2 version and simulators disappeared.就我而言,我将我的 xcode 更新为 9.2 版本,模拟器消失了。

I found this solution and it worked for me and for others also.我找到了这个解决方案,它对我和其他人都有效。

** **

Just quit your xcode and restart again.只需退出您的 xcode 并重新启动。 You will have simulators.你会有模拟器。

** **

如果您刚刚更新了 Xcode,您可能需要在模拟器再次可用之前重新启动计算机。

If you updated Xcode to 12.1.如果您将 Xcode 更新到 12.1。 Completely quit Xcode and it will install components.完全退出 Xcode,它将安装组件。

在此处输入图片说明

I ran into another situation where this can occur.我遇到了另一种可能发生这种情况的情况。 I work with a team we use Xcode server for continuous integration.我与一个团队合作,我们使用 Xcode 服务器进行持续集成。 The server wasn't seeing any simulators, but only for one project.服务器没有看到任何模拟器,而只是针对一个项目。 I eventually determined that this was due to the fact that the version of Xcode on our server was one release earlier, and the Xcode project was set to build to the newest version available.我最终确定这是因为我们服务器上的 Xcode 版本是较早的一个版本,并且 Xcode 项目设置为构建到可用的最新版本。 Simply updating Xcode solved the issue for us.简单地更新 Xcode 就为我们解决了这个问题。

I had this happen to me after an update to a new Xcode.在更新到新的 Xcode 后,我遇到了这种情况。 Running跑步

xcode-select --install

fixed it for me.为我修好了。

Just go to Xcode -> Window -> Devices只需转到 Xcode -> 窗口 -> 设备

Click + at the bottom left点击左下角的+

Add your new Simulator添加您的新模拟器

I just needed a good, old fashioned restart the computer.我只需要一个好的,老式的重新启动计算机。 When uninstalling and reinstalling XCode didn't do the job, I restarted out of pure frustration....lo and behold!当卸载并重新安装 XCode 没有成功时,我纯粹是出于沮丧而重新启动......瞧! After a restart, everything was as it should be.重新启动后,一切正常。

After upgrading to Xcode 10.3, the list of simulators was empty.升级到 Xcode 10.3 后,模拟器列表为空。 I rebooted and it was resolved.我重新启动并解决了。

This doesn't necessarily answer the OP's specific question, but this was the first place I ended up in researching my Xcode 10.3 upgrade issue.这不一定回答 OP 的具体问题,但这是我最终研究 Xcode 10.3 升级问题的第一个地方。

Lower the Deployment Target version.降低部署目标版本。 For example you have set the target as iOS 13.4 but your Xcode version is lower and there is no iOS 13.4 installed simulator.例如,您已将目标设置为 iOS 13.4,但您的 Xcode 版本较低且没有安装 iOS 13.4 模拟器。

我有同样的问题,从导入的项目生成,该项目的部署目标为 10.3,而我只安装了 10.0,将部署目标更改为 10.0 解决了我的问题。

For anyone struggling with this, I tried the mentioned options without success. 对于任何为此苦苦挣扎的人,我都尝试了上述选项,但没有成功。 Turns out all I needed to do was just quit and relaunch Xcode. 事实证明,我要做的只是退出并重新启动Xcode。 Simple things can be annoying sometimes. 简单的事情有时会令人讨厌。

In my case I had created a static library target for tvOS in Xcode 8.3.3, and the tvOS simulator was not showing up in the list. 就我而言,我已经在Xcode 8.3.3中为tvOS创建了一个静态库目标,并且tvOS模拟器未显示在列表中。 Eventually found out that TARGETED_DEVICE_FAMILY in the Build Settings was set to 1,2 instead of 3 . 最终发现,“构建设置”中的TARGETED_DEVICE_FAMILY设置为1,2而不是3 Leaving this here incase anyone else encounters the same problem. 万一其他人遇到相同的问题,请留在这里。

I simply Renamed my Xcode file in Application folder to something else and renamed it back to Xcode. 我只是将Application文件夹中的Xcode文件重命名为其他名称,然后将其重命名为Xcode。

Worked 工作了

Install iOS Simulator if you're missing one.如果您缺少 iOS 模拟器,请安装它。

点击这里看看如何。

Nothing worked for me, except没有什么对我有用,除了

gem install snapshot

fastlane snapshot reset_simulators

In my case I thought I created a new project using the iOS Framework template, but I inadvertently selected the macOS Framework template instead.就我而言,我以为我使用 iOS 框架模板创建了一个新项目,但我无意中选择了 macOS 框架模板。 This was preventing me from building the project for iPhone simulators.这阻止了我为 iPhone 模拟器构建项目。 Deleting the project and recreating it, this time selecting the iOS Framework template, fixed the problem.删除项目并重新创建它,这次选择 iOS 框架模板,解决了问题。

在xcode下的应用商店中检查是否显示GET而不是已安装,删除当前版本并获取新版本

I encountered this problem when I update my xcode to 8.2beta (with the app name xcode-beta.app), I found the answer above by Jeremy Huddleston Sequoia and tried to rename xcode-beta.app to xcode.app, it worked.当我将我的 xcode 更新为 8.2beta(应用程序名称为 xcode-beta.app)时遇到了这个问题,我找到了 Jeremy Huddleston Sequoia 上面的答案,并尝试将 xcode-beta.app 重命名为 xcode.app,它有效。 I guess the name should be xcode.app to use the simulators, even if you didn't changed the name by yourself when you download the beta one.我想名称应该是 xcode.app 以使用模拟器,即使您在下载 beta 版时没有自己更改名称。

Nothing helped me so I downloaded the simulators for my deployment Target.没有什么帮助我,所以我下载了我的部署 Target 的模拟器。

  • Beside play button and target name where simulator is chosen,在选择模拟器的播放按钮和目标名称旁边,
  • Click the simulator to see the simulator list window.单击模拟器以查看模拟器列表窗口。
  • Click on the last button is "Download Simulators"点击最后一个按钮是“下载模拟器”
  • Download the simulators for your deployment Target为您的部署目标下载模拟器

    You can check Deployment target :您可以检查部署目标:

  • Below play button 1st tab ie Project navigator, Click it and click on Project name在播放按钮第一个选项卡下方,即项目导航器,单击它并单击项目名称
  • Select your target > General tab > Deployment Info > Deployment target.选择您的目标 > 常规选项卡 > 部署信息 > 部署目标。

Hope it helps希望能帮助到你

In my case the problem was in Architectures parameter.就我而言,问题出在架构参数中。 It was set to arm64 I just changed the value to Standard Architectures (arm64, armv7) - $(ARCHS_STANDARD) Then pod install它设置为arm64我只是将值更改为Standard Architectures (arm64, armv7) - $(ARCHS_STANDARD)然后pod install 在此处输入图像描述

After trying a lot of suggestions, the below command solved the issue for me.在尝试了很多建议之后,下面的命令为我解决了这个问题。

Try to restart the simulator service:尝试重启模拟器服务:

sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService

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

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