简体   繁体   English

任何人都可以在模拟器中运行的 xcode 构建/归档应用程序

[英]xcode build/archive app for anyone to run in a simulator

I am trying to figure out how I can build/archive my iOS application in xcode so that I can send it to anyone and they can run in it a simulator.我想弄清楚如何在 xcode 中构建/归档我的 iOS 应用程序,以便我可以将它发送给任何人,他们可以在模拟器中运行。 I thought I could just build it and run it in the simulator and pull the .app file however I have no luck.我以为我可以构建它并在模拟器中运行它并拉出 .app 文件,但是我没有运气。 I would like to build it so anyone I give it to can run it in any simulator using the phonegap ios-sim.我想构建它,以便我提供给它的任何人都可以使用 phonegap ios-sim 在任何模拟器中运行它。

Any information would be great!任何信息都会很棒!

Thanks谢谢

All answers here are wrong.这里所有的答案都是错误的。

You cannot run an .IPA file on the simulator.您不能在模拟器上运行 .IPA 文件。 The simulator runs files which are compiled for the x86 processor, while IPA files are compiled for the ARM processor in the iPhone.模拟器运行的文件是为 x86 处理器编译的,而 IPA 文件是为 iPhone 中的 ARM 处理器编译的。 Additionally .IPA files must contain a valid certificate while apps for the simulator do NOT need a certificate.此外,.IPA 文件必须包含有效证书,而模拟器的应用程序不需要证书。

After building the app, go to the left side navigator bar, select Products > appName.app, right click it and select 'Show in Finder'.构建应用程序后,转到左侧导航栏,选择产品 > appName.app,右键单击它并选择“在 Finder 中显示”。 Finder will show the .app file and you can send the file to your colleague / client and ask them to drag and drop it into iOS Simulator. Finder 将显示 .app 文件,您可以将该文件发送给您的同事/客户,并要求他们将其拖放到 iOS 模拟器中。

获取模拟器的 ios .app 文件夹

If you have the .app bundle, you can create a tarball of it and send it to someone else.如果您有 .app 包,您可以创建它的 tarball 并将其发送给其他人。 They can then extract it and use xcrun simctl install <device UDID> <path to app bundle> to install your app in the given simulator device.然后他们可以提取它并使用xcrun simctl install <device UDID> <path to app bundle>在给定的模拟器设备中安装您的应用程序。

  1. Build the app in simulator, then locate the simulator data folder.在模拟器中构建应用程序,然后找到模拟器数据文件夹。 You can get the list of simulator UDID by typing instruments -s devices in Terminal.您可以通过在终端中输入instruments -s devices来获取模拟器 UDID 的列表。 The UDID is the string between the square brackets. UDID 是方括号之间的字符串。 Locate your finder to ~/Library/Developer/CoreSimulator/Devices/[Simulator UDID]将您的查找器定位到~/Library/Developer/CoreSimulator/Devices/[Simulator UDID]

  2. Inside your simulator data folder, locate to data/Containers/Bundle/Application , you will see some folder there if you have multiple apps built before, open them one by one and find the one with your app name inside.在你的模拟器数据文件夹中,找到data/Containers/Bundle/Application ,如果你之前构建了多个应用data/Containers/Bundle/Application ,你会在那里看到一个文件夹,一个一个打开它们,找到里面有你的应用程序名称的那个。

  3. Compress the app_name.app and send it to others.压缩app_name.app并发送给其他人。 Ask other to use the command instruments -s devices in terminal to find the UDID as well.要求其他人在终端中使用命令instruments -s devices来查找 UDID。

  4. Open Xcode and the selected simulator, then open terminal, type xcrun simctl install <Device UDID> <Path to unzipped app_name.app>打开Xcode和选择的模拟器,然后打开终端,输入xcrun simctl install <Device UDID> <Path to unzipped app_name.app>

The app should install successfully in the simulator, I wrote a blog post about this with screenshot guide here : https://fluffy.es/how-to-archive-ios-app-for-simulator/该应用程序应该在模拟器中成功安装,我写了一篇关于这个的博客文章,这里有截图指南: https : //fluffy.es/how-to-archive-ios-app-for-simulator/

First off you will need a release build (not a dev build) to share the installable simulator .app首先,您需要一个发布版本(不是开发版本)来共享可安装的模拟器.app

To generate a Release build:要生成发布版本:

  1. make sure you go into edit scheme (next to the simulator selector)确保您进入编辑方案(在模拟器选择器旁边)

  2. Under Run change the build configuration to Release在运行下将构建配置更改为发布

Then you can right click the app and go into the DerivedData//Build/Products/Release-iphonesimulator/.app然后你可以右键单击应用程序并进入 DerivedData//Build/Products/Release-iphonesimulator/.app

Copy the .app and share with whoever has xcode.复制 .app 并与拥有 xcode 的人共享。

That person then needs to do a few things.然后那个人需要做一些事情。

  1. Download your app and add it in a location that they can access the path.下载您的应用程序并将其添加到他们可以访问路径的位置。 example: Users/<username>/Downloads/test.app示例: Users/<username>/Downloads/test.app

  2. Get the device ID xcrun simctl list devices example 7FAB6CD2-70D0-416F-9C50-4C7C23B2ABCD获取设备 ID xcrun simctl list devices示例7FAB6CD2-70D0-416F-9C50-4C7C23B2ABCD

  3. With a valid simulator id, run xcrun simctl install 7FAB6CD2-70D0-416F-9C50-4C7C23B2ABCD Users/<username>/Downloads/test.app使用有效的模拟器 ID,运行xcrun simctl install 7FAB6CD2-70D0-416F-9C50-4C7C23B2ABCD Users/<username>/Downloads/test.app

  4. The app should install and they should be able to open the app.该应用程序应该安装并且他们应该能够打开该应用程序。

First of all set proper bundle identifier with build setting and iOS version which is required for run app.首先,使用运行应用程序所需的构建设置和 iOS 版本设置正确的包标识符。

** **

For Device对于设备

** 1. ** 1。

You can Build Archive using and generate ipa您可以使用并生成 ipa 构建存档

or build app then you will get .app you can drag .app in itune and get .ipa by show in finder.或构建应用程序,然后您将获得 .app 您可以在 iTunes 中拖动 .app 并通过在 finder 中显示获得 .ipa。

** **

For Simulator模拟器用

** 2. path:- /Users/Krishan/Library/Application Support/iPhone Simulator/6.0/Applications Open above path and zip app folder which you want to share.Now unzip folder paste on same above path app shown in simulator will run successfully. ** 2. 路径:- /Users/Krishan/Library/Application Support/iPhone Simulator/6.0/Applications打开上面的路径并压缩要共享的应用程序文件夹。现在解压文件夹粘贴到模拟器中显示的相同路径应用程序将运行成功地。

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

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