開發(fā)過(guò)程中,總免不了為測(cè)試打包,過(guò)程重復(fù)且耗費(fèi)時(shí)間,所幸,可以選擇自動(dòng)化打包
xcodebuild
xcodebuild 是蘋果發(fā)布自動(dòng)構(gòu)建的工具,
xcodebuild -h
xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild [-project <projectname>] -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -workspace <workspacename> -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]
xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]] [-json]
xcodebuild -showsdks
xcodebuild -exportArchive -archivePath <xcarchivepath> -exportPath <destinationpath> -exportOptionsPlist <plistpath>
xcodebuild -exportLocalizations -localizationPath <path> -project <projectname> [-exportLanguage <targetlanguage>...]
xcodebuild -importLocalizations -localizationPath <path> -project <projectname>
前三條命令是比較常用的
xcodebuild -list
xcodebuild -list:lists the targets and configurations in a project, or the schemes in a workspace
定位到工程目錄下,執(zhí)行 xcodebuild -list,以我的工程為例,輸出如下:
? SAUserModuleTest git:(master) ? xcodebuild -list
Information about project "SAUserModuleTest":
Targets:
SAUserModuleEnterprise
SAUserModuleCompany
Build Configurations:
Dev
Debug
Cit
Release
If no build configuration is specified and -scheme is not passed then "Release" is used.
Schemes:
SAUserModuleTest
SAUserModuleEnterprise
SAUserModuleCompany
編譯
我的工程中使用了cocoapods,因此在編譯時(shí)使用了 -workspace,并指定所需要build的 Configuration 和 Scheme,如下:
xcodebuild -workspace SAUserModuleTest.xcworkspace -configuration Cit -scheme SAUserModuleEnterprise
編譯過(guò)程中會(huì)打印諸多編譯信息,不出錯(cuò)的話基本沒(méi)必要看所打印的信息(太多啦),下面展示一張出錯(cuò)的圖:

build_failed.png
改錯(cuò),再來(lái)一遍!Again?。?!

Build_Success.png
Success!??!
libimobiledevice
官方github地址:https://github.com/libimobiledevice/libimobiledevice