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

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

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

iosxcodetesting

提问by pAkY88

I would like to test my app on older versions of iOS. By "older versions" I mean iOS 5.1 5.0 and 4.3. In order to do so, what should I do in 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. The only choice I have is to run my app on iPhone/iPad 6.0 simulator.

我想在旧版本的 iOS 上测试我的应用程序。“旧版本”是指 iOS 5.1 5.0 和 4.3。为此,我应该在 Xcode 中做什么?我已经(通过 Xcode)下载了所有相应的模拟器,但我不知道如何在特定模拟器上构建和运行我的应用程序。我唯一的选择是在 iPhone/iPad 6.0 模拟器上运行我的应用程序。

Thanks.

谢谢。

采纳答案by Krishnabhadra

I think your applications deployment target is set to 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 6.0. 使其成为您想要的最低版本。我相信 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.
  1. 在项目导航中选择项目文件
  2. 点击你的目标
  3. 在摘要选项卡中,选择您的部署目标。

EDIT: After seeing @Abizern answer.Well I answered to this part in the question.

编辑:看到@Abitern 的回答后。好吧,我在问题中回答了这一部分。

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. It was because his project base sdk target and deployment target was set to iOS 6.0. By setting deployment target to a lower version, other simulators started to show up.

OP 没有让旧版本的模拟器显示在下拉菜单中。这是因为他的项目基础 sdk 目标和部署目标设置为iOS 6.0. 通过将部署目标设置为较低版本,其他模拟器开始出现。

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. Well just to make it clear.

但正如@Abitern 正确指出的那样,要在较低版本的模拟器上运行,您必须从下拉菜单中选择正确的模拟器才能运行。好吧只是为了说清楚。

回答by Abizern

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 左上角的下拉菜单 - 您可以从那里选择已安装的模拟器来运行您的应用程序。

回答by Paul Herron

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 的运行菜单中选择它。

回答by Gustavo Barbosa

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.

在侧边栏左侧,单击列表的第一个元素(通常是您的项目名称)。将打开一个新菜单,就像我的屏幕截图一样。

Screenshot

截屏

Just select the target that you want to simulate.

只需选择要模拟的目标即可。