xcode 我可以在模拟器中运行旧的应用程序存档吗?

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

Can I run an old app archive in the Simulator?

iosobjective-cxcode

提问by Resh32

When we deploy new versions of the iOS app into the App Store through XCode, an archive is generated.

当我们通过 XCode 将新版本的 iOS 应用部署到 App Store 时,会生成一个存档。

Is there a way to take an old archive and run it in the simulator? I would like to do that in order to be able to easily test backward compatibility of the server-side code with all the previous versions of the app (or at least the two mostly used at that time).

有没有办法获取旧存档并在模拟器中运行它?我想这样做是为了能够轻松测试服务器端代码与该应用程序的所有先前版本(或至少当时最常用的两个版本)的向后兼容性。

I know that I could commit into a GIT repository and pull a specific version, but that has two problems: a. it is more complex than simply running an archive, b. it is error-prone and stops development of the new version on the machine it is done, and c. there could be some bias related to the compiler changes or any other XCode change in between rendering the version hard to compile.

我知道我可以提交到 GIT 存储库并提取特定版本,但这有两个问题:a。它比简单地运行存档更复杂,b。它容易出错并且会在完成的机器上停止新版本的开发,并且 c. 可能存在与编译器更改或任何其他 XCode 更改相关的偏差,从而导致版本难以编译。

I could not find any help on that on StackOverflow, nor any sign of this possibility in the Archive repository in XCode. Should I file a feature request @ Apple?

我在 StackOverflow 上找不到任何帮助,在 XCode 的存档存储库中也找不到任何这种可能性的迹象。我应该向 Apple 提交功能请求吗?

采纳答案by jn_pdx

No, you can't take an archive generated for the App Store and run it in the simulator -- even if you could deal with the signing issues, etc, the archive generated for the App Store contains code compiled for ARM processors, which the i-devices have. Code built for the simulator is compiled for x86 processors, so that it can run on Macs.

不,您不能使用为 App Store 生成的存档并在模拟器中运行它——即使您可以处理签名问题等,为 App Store 生成的存档包含为 ARM 处理器编译的代码, i-devices 有。为模拟器构建的代码是为 x86 处理器编译的,因此它可以在 Mac 上运行。

回答by zoul

One reasonably easy way to do this is through Test Flight. We routinely test new versions through Test Flight, the old ones stay there and it's possible to return to them anytime. It's a different build than the one you finally submit to the App Store, but that's something that will always be true, as the App Store build is signed using the distribution certificate and AFAIK won't run anywhere unless installed through the store.

一种相当简单的方法是通过Test Flight。我们经常通过 Test Flight 测试新版本,旧版本留在那里,随时可以返回。它与您最终提交给 App Store 的构建版本不同,但这总是正确的,因为 App Store 构建版本是使用分发证书签名的,除非通过商店安装,否则 AFAIK 不会在任何地方运行。

回答by Mr Bonjour

You can make OTA (over the air) version of your app (then you can download those binary from a server), or simply create an ipa file and install it from iTunes.

您可以制作应用程序的 OTA(无线)版本(然后您可以从服务器下载这些二进制文件),或者简单地创建一个 ipa 文件并从 iTunes 安装它。

In order to do this, you must create an adhoc provisioning profil. Check Apple documentation, since it's a little complicated to explain

为此,您必须创建一个临时配置文件。检查Apple文档,因为解释起来有点复杂

回答by Lefteris

If your archive was build for a device (AdHoc or Release) you can make an ipa file and install it on a device (explanation below on how-to). If it was build for the simulator (meaning i386 cpu architecture) then you can't create the ipa for the device.

如果您的存档是为设备(AdHoc 或 Release)构建的,您可以制作一个 ipa 文件并将其安装在设备上(以下说明如何操作)。如果它是为模拟器构建的(意味着 i386 cpu 架构),那么你不能为设备创建 ipa。

As far as I know, you can make an ipa out of an Xcode 4 archive using command line:

据我所知,您可以使用命令行从 Xcode 4 存档中制作 ipa:

/usr/bin/xcrun -sdk iphoneos PackageApplication
  "/absolute/path/to/MyApp.xcarchive/Products/Applications/MyApp.app"
  -o "/absolute/path/to/MyApp.ipa"

After you get the ipa, you can install it on physical devices, if it had been created with the correct signature, else you can re-sign it

拿到ipa后,可以安装在物理设备上,如果是用正确的签名创建的,否则可以重新签名