xcode 如何使用 watchkit 应用程序从命令行生成 .ipa 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29522191/
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
How to generate .ipa file from command line with watchkit app
提问by RPM
I have a jenkins instance that does a release build using xcodebuild. I then have a script (on Jenkins) to create the .ipa file using xcrun. this worked fine for us until now. Now we have a watchkit app and the .ipa file that is created from this process is not the same as the one that is created if you do an archive build and export it from Xcode.
我有一个 jenkins 实例,它使用 xcodebuild 进行发布构建。然后我有一个脚本(在 Jenkins 上)使用 xcrun 创建 .ipa 文件。直到现在,这对我们来说都很好。现在我们有一个 watchkit 应用程序,并且在此过程中创建的 .ipa 文件与您进行存档构建并从 Xcode 导出时创建的文件不同。
The exported .ipa from Xcode has a 'Payload' folder, a 'Symbols' folder (probably optional) and a 'WatchKitSupport' folder. The ipa generated from the xcrun doesnt have the 'Symbols' or the 'WatchKitSupport' folder. See more about the structure here : https://stackoverflow.com/a/29400301/327386
从 Xcode 导出的 .ipa 有一个“Payload”文件夹、一个“Symbols”文件夹(可能是可选的)和一个“WatchKitSupport”文件夹。从 xcrun 生成的 ipa 没有“Symbols”或“WatchKitSupport”文件夹。在此处查看有关结构的更多信息:https: //stackoverflow.com/a/29400301/327386
I saw this post on SO : https://stackoverflow.com/a/19856005/327386that has commands to archive and export the .ipa build (similar to the Xcode process) but even that didn't create the new folders in question.
我在 SO 上看到了这篇文章:https: //stackoverflow.com/a/19856005/327386,它具有归档和导出 .ipa 构建的命令(类似于 Xcode 过程),但即使这样也没有创建有问题的新文件夹.
Does anyone know if there is a way to use the command line tools to create an .ipa file that is equivalent to the one created by Xcode? I didn't find any official documentation on this
有谁知道是否有一种方法可以使用命令行工具来创建与 Xcode 创建的文件等效的 .ipa 文件?我没有找到任何关于此的官方文档
回答by Szabó Csaba
Exact problem
确切的问题
xcodebuild -exportArchive
cannot make valid IPA with Watch Extension, it's an Apple bug (http://openradar.appspot.com/20898925).
xcodebuild -exportArchive
无法使用 Watch Extension 制作有效的 IPA,这是 Apple 的错误 ( http://openradar.appspot.com/20898925)。
Official (Xcode 7) solution
官方(Xcode 7)解决方案
Apple solved this problem in Xcode 7 with the -exportOptionsPlist
flag of the xcodebuild -exportArchive
command. You can find more details about it in this article.
Apple 在 Xcode 7 中使用命令的-exportOptionsPlist
标志解决了这个问题xcodebuild -exportArchive
。您可以在本文中找到有关它的更多详细信息。
Not-official (Xcode 6) solutions
非官方(Xcode 6)解决方案
There are workarounds for the problem. If it's urgent then you can play with them, but I couldn't find a workaround which was working for everybody (based on forum discussions).
该问题有一些解决方法。如果情况紧急,那么您可以与他们一起玩,但我找不到适合所有人的解决方法(基于论坛讨论)。
回答by Mani Kandan
I too faced the same issue. The command line tool exportArchive misses the required Watchkit support folders while exporting the archive to ipa. I tried figured it out using the below shell script.
我也面临同样的问题。命令行工具 exportArchive 在将存档导出到 ipa 时缺少所需的 Watchkit 支持文件夹。我尝试使用下面的 shell 脚本来解决这个问题。
https://gist.github.com/phatblat/6eb8895e2202f796960e
https://gist.github.com/phatblat/6eb8895e2202f796960e
You can call the above shellscript from your Jenkins buildscript like below.
你可以从你的 Jenkins 构建脚本中调用上面的 shellscript,如下所示。
<exec executable="/bin/bash" failonerror="true">
<arg value="${root.dir}/buildscripts/package-ida.sh" />
<arg value="${build.dir}/APP_NAME.xcarchive" />
<arg value="${build.dir}/APP_NAME.ipa" />
</exec>
Now You will be able to see the WatchKit support folder in your ipa payload and your appstore app validation will also get succeeded using the generated Jenkins build.
现在,您将能够在您的 ipa 负载中看到 WatchKit 支持文件夹,并且您的 appstore 应用程序验证也将使用生成的 Jenkins 构建成功。