是否可以通过命令行执行iOS应用程序的本地验证(可以在Archives下的Organizer中查看)?
更新:只是为了澄清 - 这里的目标是最终使这个验证成为iOS应用程序持续集成过程的一部分。
答案 0 :(得分:27)
您可以使用以下命令从命令行进行验证:
xcrun -sdk iphoneos Validation /path/to/App.{app or ipa}
有点不清楚检查它执行的是什么,但可能它至少做了代码签名和图标尺寸。
除了本地验证之外,还可以执行在线验证(但仅适用于IPA包):
xcrun -sdk iphoneos Validation -verbose -online /path/to/App.ipa
为此,您需要将 iTunes Connect 凭据存储在钥匙串的特殊条目中。要创建此条目:
Xcode:itunesconnect.apple.com
在线验证似乎相当粗略,但是在Xcode中使用Organizer窗口验证存档的所有检查都是如此。遗憾的是,它似乎没有在失败时设置非零退出代码,这意味着输出抓取以检测错误。我目前用于检测失败的启发式是在Performing online validation...
行之后存在任何输出。
鉴于缺乏文档,几乎肯定不支持。
答案 1 :(得分:25)
过去我使用过这个命令:
xcrun -sdk iphoneos Validation /path/to/MyApp.app or /path/to/MyApp.ipa
这将检查代码签名,图标尺寸等。我不确定Xcode Organizer或Application Loader应用程序除了此工具之外是否还执行任何其他验证,并且工具本身没有帮助或命令行标记,我可以找到。
<强>更新强>:
这个问题促使我深入挖掘。运行strings
工具会显示以下开关:
-verbose
-upload
-warnings
-errors
-online
-online
选项显然会验证iTunes连接中第一个可用应用程序的二进制文件,但我还没想出如何将用户名/密码传递给命令。但是,我猜测持续集成你可能只想进行本地验证。
答案 2 :(得分:22)
如果您只想验证签名的ipa文件,可以使用工具 altool
$ /Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool -h
Copyright (c) 2009-2015, Apple Inc. Version 1.1
Usage: altool --validate-app -f file -t platform -u username [-p password]
altool --upload-app -f file -t platform -u username -p password
-f, --file Filename.
-t, --type Type/Platform: osx, ios.
-u, --username Username. Required to connect for validation and upload.
-p, --password Password. Required if username specified. Password is read from stdin if one is not supplied.
May use @keychain: or @env: prefixes followed by the keychain or environment variable lookup name.
e.g. -p @env:SECRET which would use the value in the SECRET environment variable.
-v, --validate-app Validate an app archive. The username, password, and file path to app archive are required.
--upload-app Uploads the given app archive. The username, password, and file path to app archive are required.
--output-format [xml | normal] 'xml' displays error output in a structured format; 'normal' outputs in an unstructured format (default)
-h, --help Display this output.
对于前。
/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool -v -f APP.ipa -u itunesconnect@user.com -p password
答案 3 :(得分:4)
您可以在altool命令的帮助下验证应用程序,如下所示:
./ altool --validate-app -f&lt;'ipaFile'&gt;
答案 4 :(得分:0)
有些参数可以让您通过api密钥进行授权
xcrun altool \
--validate-app \
--file "<ipa file>" \
--apiKey "<appstore api key>" \
--apiIssuer "<appstore issuer id>"