简体   繁体   English

Xcode:如何在旧版iOS上测试我的应用程序

[英]Xcode: how to test my app on older versions of iOS

I would like to test my app on older versions of iOS. 我想在旧版iOS上测试我的应用程序。 By "older versions" I mean iOS 5.1 5.0 and 4.3. “旧版本”是指iOS 5.1 5.0和4.3。 In order to do so, what should I do in Xcode? 为了做到这一点,我应该在Xcode中做些什么? I've already downloaded (through Xcode) all the corresponding simulators, but I don't know how to build and run my app on a specific simulator. 我已经下载了(通过Xcode)所有相应的模拟器,但我不知道如何在特定的模拟器上构建和运行我的应用程序。 The only choice I have is to run my app on iPhone/iPad 6.0 simulator. 我唯一的选择是在iPhone / iPad 6.0模拟器上运行我的应用程序。

Thanks. 谢谢。

Both of these answers weren't clear enough, I'm adding this to stop people making incorrect assumptions. 这两个答案都不够明确,我补充说这是为了阻止人们做出错误的假设。

The only way to test on a lower version of the iOS is to run it on a device with the lower version or on one of the lower version simulators. 在较低版本的iOS上测试的唯一方法是在具有较低版本的设备上或在较低版本的模拟器之一上运行它。

The "Deployment Target", which both answers here incorrectly say runs the app on a lower version, just sets the minimum installed OS version that the app will run on. “部署目标”(这两个都在这里错误地回答说是在较低版本上运行应用程序,只是设置应用程序将运行的最小安装操作系统版本。 When you run it on the iOS 6 simulator - it is still running on the version 6, not to whatever your deployment target is set at. 当您在iOS 6模拟器上运行它时 - 它仍然在版本6上运行,而不是在您设置的部署目标上运行。

But, without setting a lower deployment target, the option to use a different iOS Simulator isn't available. 但是,如果不设置较低的部署目标,则无法使用其他iOS模拟器。

Best practice is to build with the latest version and SDK available and set the deployment target to the lowest version that your app supports. 最佳做法是使用最新版本和SDK构建,并将部署目标设置为应用程序支持的最低版本。

As for running the app on different versions of the simulator - have a look at the dropdown in the top left corner of Xcode - you can pick which of the installed simulators to run your app on from there. 至于在不同版本的模拟器上运行应用程序 - 看看Xcode左上角的下拉列表 - 您可以从那里选择要运行应用程序的已安装模拟器。

I think your applications deployment target is set to iOS 6.0 . 我认为您的应用程序部署目标设置为iOS 6.0 Make it to the lowest version you want. 使其达到您想要的最低版本。 I believe iOS 4.3 is the lowest that is possible right now. 我相信iOS 4.3是目前最低的。

To change deployment target, 要更改部署目标,

  1. Select project file in Project Navigation 在项目导航中选择项目文件
  2. Click your target 单击您的目标
  3. In the summary tab, choose your deployment target. 在摘要选项卡中,选择部署目标。

EDIT: After seeing @Abizern answer. 编辑:看到@Abizern回答后。 Well I answered to this part in the question. 好吧,我在问题中回答了这一部分。

The only choice I have is to run my app on iPhone/iPad 6.0 simulator. 我唯一的选择是在iPhone / iPad 6.0模拟器上运行我的应用程序。

OP was not getting older version of simulator to show up in the drop down menu. OP没有让老版本的模拟器显示在下拉菜单中。 It was because his project base sdk target and deployment target was set to iOS 6.0 . 这是因为他的项目基础sdk目标和部署目标设置为iOS 6.0 By setting deployment target to a lower version, other simulators started to show up. 通过将部署目标设置为较低版本,其他模拟器开始出现。

But as @Abizern correctly pointed out, to run on a simulator of lower version you have to choose the correct simulator from dropdown menu to run. 但正如@Abizern正确指出的那样,要在较低版本的模拟器上运行,您必须从下拉菜单中选择正确的模拟器才能运行。 Well just to make it clear. 好吧,只是为了说清楚。

Open Xcode and in the menu at the top left, where you select what device to run on, click "More Simulators..." 打开Xcode,在左上角的菜单中选择要运行的设备,单击“更多模拟器...”

The download section of Xcode preferences will open, Xcode首选项的下载部分将打开,

Click the "Components" tab. 单击“组件”选项卡。

You will see a list of simulators that can be installed, click install on version you need. 您将看到可以安装的模拟器列表,单击您需要的版本上的安装。

The simulator will need to restart to install. 模拟器需要重新启动才能安装。

To run the newly installed version of the simulator just select it from the run menu in Xcode. 要运行新安装的模拟器版本,只需从Xcode中的运行菜单中选择它即可。

At the sidebar left, click on the first element of the list(usually is the name of your project). 在左侧边栏,单击列表的第一个元素(通常是项目的名称)。 A new menu will open, like my screenshot. 将打开一个新菜单,就像我的截图一样。

截图

Just select the target that you want to simulate. 只需选择要模拟的目标即可。

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

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