Xcode 只允许我为 iOS 设备运行(没有模拟器)

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

Xcode only lets me run for an iOS device (no simulator)

xcodesimulator

提问by swickblade

I just cloned a project into Xcode and am trying to run it in the simulator. However, my only option is iOS Device. This is unique to this project only and I don't know how to fix it. Anyone else run into this and know how to fix it?

我刚刚将一个项目克隆到 Xcode 中,并尝试在模拟器中运行它。但是,我唯一的选择是 iOS 设备。这仅适用于该项目,我不知道如何修复它。其他人遇到过这个问题并知道如何解决它?

screenshot

截屏

回答by Samuel Sharaf

Under Your project Build Settings

在您的项目构建设置下

  1. select Deployment section
  2. change iOS Deployment Target to a version iOS 5.0 or less
  3. now you can go ahead and change the deployment target from device to simulator!
  1. 选择部署部分
  2. 将 iOS 部署目标更改为 iOS 5.0 或更低版本
  3. 现在您可以继续将部署目标从设备更改为模拟器!

In my case the deployment target was set to version 5.1 and i still am running snow leapord OS with appropriate JARS copied from xcode 4.3 to make it run with a device running iOS 5.1.

在我的例子中,部署目标被设置为 5.1 版,我仍然在使用从 xcode 4.3 复制的适当 JARS 运行雪飞跃 OS,以使其与运行 iOS 5.1 的设备一起运行。

However, my simulators do not yet support version 5.1 so till i changed the deployment target to lower version e.g. 5.0 or 4.2 it won't let me run on simulator.

但是,我的模拟器尚不支持 5.1 版,因此在我将部署目标更改为较低版本(例如 5.0 或 4.2)之前,它不会让我在模拟器上运行。

回答by Gank

Click to target or project > Build Settings > Achitecture > Supported Platforms : change to iOS

单击目标或项目 > 构建设置 > 架构 > 支持的平台:更改为 iOS

回答by Brandon M

What worked for me was going to Window>Devices and pressing the plus button at the bottom left to add a device and choose the simulator you want to add.

对我有用的是转到窗口>设备并按左下角的加号按钮添加设备并选择要添加的模拟器。

回答by Honey

The problem for me happened when I downloaded a project from someone else and their deployment target was like 10.2 and my Xcode wasn't fully updated so it only supported til 10.0.

当我从其他人那里下载一个项目并且他们的部署目标是 10.2 并且我的 Xcode 没有完全更新所以它只支持直到 10.0 时,我的问题发生了。

Solution was :

解决方案是:

Click on project >> General >> Deployment Info >> Deployment Target

单击项目>>常规>>部署信息>>部署目标

From there just change it from a grayed out number to a number that it's not.

从那里只需将其从灰色数字更改为不是数字。

enter image description here

在此处输入图片说明

回答by Asif Bilal

No big deal. I have just restarted the Xcode & iOS simulator. Then, it displayed all the simulators.

没什么大不了。我刚刚重新启动了 Xcode 和 iOS 模拟器。然后,它显示了所有的模拟器。

回答by CedricSoubrie

After restoring from time machine, I had to reinstall the 8.1 simulator (settings > Download) and then adding simulators in "Window > Devices > + > Add simulator"

从时间机器恢复后,我不得不重新安装 8.1 模拟器(设置 > 下载),然后在“窗口 > 设备 > + > 添加模拟器”中添加模拟器

回答by CKJBeOS

for me just go to Settings, tab "Downloads" and download the simulator ;) Append after changed computer (resored by TimeMachine) Regards,

对我来说,只需转到“设置”,“下载”选项卡并下载模拟器;) 在更换计算机后附加(由 TimeMachine 恢复) 问候,

回答by Steve

When none of the above steps work, check to see that your device is plugged in and turned on. (None of the above steps worked for me, and the device WAS plugged in. Oh well.) However, I have Xcode 7.3.

如果上述步骤均无效,请检查您的设备是否已插入并打开。(以上步骤都不适合我,并且设备已插入。哦,好吧。)但是,我有 Xcode 7.3。

回答by Prakash Raj

for now you just change device/simulator from Product -> Destination -> pick the device. Then Run your application.enter image description here

现在,您只需从 Product -> Destination -> 选择设备更改设备/模拟器。然后运行您的应用程序。在此处输入图片说明

回答by Clark Hymanson

What had happened to me was that I created a project using a device that had the latest iOS installed, 8.3. When I moved that project to another computer without a device the simulators didn't appear for me to choose from, only the device (which I didn't have). The reason was that the simulators only went up to 8.1 (which is less than 8.3, obviously). So I changed the 'Deployment>iOS Development Target' to 8.1 (from 8.3) in Build Settings and the simulators appeared in Xcode as expected.

发生在我身上的是我使用安装了最新 iOS 8.3 的设备创建了一个项目。当我将该项目移动到另一台没有设备的计算机时,模拟器没有出现供我选择,只有设备(我没有)。原因是模拟器只达到了 8.1(显然低于 8.3)。因此,我在构建设置中将“部署>iOS 开发目标”更改为 8.1(从 8.3),并且模拟器按预期出现在 Xcode 中。