如何在 Xcode 6 iOS Simulator 上安装应用程序

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

How to install apps on Xcode 6 iOS Simulator

iosiphonexcodeios-simulator

提问by Heman Patekar

I'm looking for a way to install the mail application on the Xcode 6 iOS Simulator.

我正在寻找一种在 Xcode 6 iOS Simulator 上安装邮件应用程序的方法。

Additionally, how do I install apps that are already public on the Appstore so that I can run them on the iOS Simulator? Is there a simple way?

此外,如何安装已在 Appstore 上公开的应用程序,以便我可以在 iOS 模拟器上运行它们?有没有简单的方法?

回答by Jeremy Huddleston Sequoia

The most common way to install an app in the iOS Simulator is to use Xcode to build and install it. If you have a simulator app bundle which was built by someone else (or archived), you can install it using simctl:

在 iOS 模拟器中安装应用程序的最常见方法是使用 Xcode 来构建和安装它。如果您有一个由其他人构建(或存档)的模拟器应用程序包,您可以使用 simctl 安装它:

xcrun simctl install booted /path/to/your.app

Keep in mind, of course, that these apps need to be iOS Simulator apps, not iOS Device apps.

当然,请记住,这些应用程序必须是 iOS 模拟器应用程序,而不是 iOS 设备应用程序。

回答by Michael Dautermann

The iOS simulator is a different compiled binary than the app that gets published on the app store.

iOS 模拟器是与在应用商店中发布的应用不同的编译二进制文件。

If you don't have access to the project's source code or simulator binaries, you can't install it on your own simulator.

如果您无权访问项目的源代码或模拟器二进制文件,则无法将其安装在您自己的模拟器上。

回答by bartosss

In Xcode 8.2, you can now drag an app onto a iOS Simulator window. See this blog: https://medium.com/@hollanderbart/new-features-in-xcode-8-2-simulator-fc64a4014a5f

在 Xcode 8.2 中,您现在可以将应用拖到 iOS 模拟器窗口中。请参阅此博客:https: //medium.com/@hollanderbart/new-features-in-xcode-8-2-simulator-fc64a4014a5f

回答by Johan

NOTE:The receiver of the simulator app has to boot up the same simulator and iOS version, as what was used to compile the simulator app bundle.

注意:模拟器应用程序的接收器必须启动与用于编译模拟器应用程序包相同的模拟器和 iOS 版本。

To install an app compiled for the simulator, you have to:

要安装为模拟器编译的应用程序,您必须:

  1. Boot up the simulator you want to install the app on (and leave it running for step 2).
  2. To install StackOverflow.app from your Desktop, write the following in terminal: xcrun simctl install booted ~/Desktop/StackOverflow.app
  1. 启动要安装应用程序的模拟器(并让它运行以进行第 2 步)。
  2. 要从桌面安装 StackOverflow.app,请在终端中写入以下内容: xcrun simctl install booted ~/Desktop/StackOverflow.app

You should now instantly see the app icon appear in the simulator (likely appearing on page 2).

您现在应该立即看到应用程序图标出现在模拟器中(可能出现在第 2 页)。



To obtain the simulator appyou want to distribute, you can run this command in the Xcode console (this works at least when the simulator app has paused on a breakpoint): po NSHomeDirectory()

要获取要分发的模拟器应用程序,您可以在 Xcode 控制台中运行此命令(这至少在模拟器应用程序在断点处暂停时有效):po NSHomeDirectory()

The folder will be something like:

该文件夹将类似于:

/Users/MyHomeFolder/Library/Developer/CoreSimulator/Devices/09BB353F-3AF9-4A2A-8CDB-0F15634AD6D8/data/Containers/Data/Application/8F509C84-6809-461D-9F9E-06811EF9A700

/Users/MyHomeFolder/Library/Developer/CoreSimulator/Devices/09BB353F-3AF9-4A2A-8CDB-0F15634AD6D8/data/Containers/Data/Application/8F509C84-6809-461D-9F9E-06811EF9A7

The app bundle will be inside the Containersfolder at Bundle/Application/3ADE9CF0-F6D0-4461-9B82-30A86580D2C7/StackOverflow.app

应用程序包将位于 Bundle/Application/3ADE9CF0-F6D0-4461-9B82-30A86580D2C7/StackOverflow.app的Containers文件夹内

Distribute the .app file, specifying the simulator device and iOS version used when compiling the bundle (the same has to be used by the receiver).

分发 .app 文件,指定编译包时使用的模拟器设备和 iOS 版本(接收者必须使用相同的版本)。