ios 使用 Xcode 的命令行构建工具存档(xcodebuild archive)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5384999/
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
Archive with Xcode's command line build tool (xcodebuild archive)
提问by Steven Fisher
The command line tool to build Xcode projects, xcodebuild, has a new build action available in Xcode 4: archive
.
用于构建 Xcode 项目的命令行工具 xcodebuild 在 Xcode 4 中提供了一个新的构建操作:archive
.
From man xcodebuild
:
来自man xcodebuild
:
archive Archive a scheme from the build root (SYMROOT). This requires specifying
a workspace and scheme.
Unfortunately, when I try to use it I get an error:
不幸的是,当我尝试使用它时,出现错误:
$ xcodebuild archive -workspace SimpleTestApp.xcworkspace -scheme SimpleTestApp
xcodebuild: error: Failed to build workspace SimpleTestApp with scheme SimpleTestApp.
Reason: The selected run destination is not valid for this action.
My impression is this doesn't actually work yet. Has anyone got it to work? If so, how?
我的印象是这实际上还行不通。有没有人让它工作?如果是这样,如何?
采纳答案by Vincent Guerci
For information I'm 99% sure that xcodebuild archive
was working in a previous Xcode 4 version, maybe a Beta
...
And this is really frustrating since -verbose
and syslogs doesn't bring much details.
有关信息,我 99% 确定它xcodebuild archive
在以前的 Xcode 4 版本中工作,也许是Beta
......这真的令人沮丧,因为-verbose
syslogs 没有带来太多细节。
So I would call that... a Bug!
所以我会称之为……一个错误!
If automating your build is what you are looking for, there is a way to generate IPA archive from command lineusing xcrun PackageApplication
如果您正在寻找自动化构建,则有一种方法可以使用命令行从命令行生成 IPA 存档xcrun PackageApplication
With xcrun
to package and xcodebuild
to build, you can almost achieve what xcodebuild archive
is supposed to do. I would prefer to use xcodebuild
since we can expect this to generate a .xcarchive
(.app
+ .dSYM
), more interesting than an IPA.
通过xcrun
打包和xcodebuild
构建,您几乎可以实现xcodebuild archive
应该做的事情。我更喜欢使用,xcodebuild
因为我们可以预期它会生成一个.xcarchive
( .app
+ .dSYM
),比 IPA 更有趣。
Not so off-topic, but if anyone knows how to get more logs from xcodebuild and Xcode, I'm really interested!
不是那么离题,但如果有人知道如何从 xcodebuild 和 Xcode 获取更多日志,我真的很感兴趣!
EDIT: After looking in Apple Forums, I confirm this is an Xcode BUG introduced with GM2... I guess Apple Xcode engineers are working on Xcode 4.1 that I think final version will be released with OSX Lion... In june maybe? With a fix? :(
编辑:查看Apple 论坛后,我确认这是 GM2 引入的 Xcode BUG...我猜 Apple Xcode 工程师正在开发 Xcode 4.1,我认为最终版本将与 OSX Lion 一起发布...也许在六月?有修复吗?:(
回答by Daniel X Moore
This seems to work for me:
这似乎对我有用:
xcodebuild -project TestApp.xcodeproj -scheme TestApp -configuration "Ad Hoc" archive
回答by Sébastien Stormacq
Is this working from the GUI ? Project -> Build for Archive Then you can find the archive back in Organizer (archive Tab) It is working for me in the GUI
这是从 GUI 工作吗?Project -> Build for Archive 然后你可以在 Organizer(archive Tab)中找到档案,它在 GUI 中对我有用