iOS自动化打包

开发过程中,总免不了为测试打包,过程重复且耗费时间,所幸,可以选择自动化打包

xcodebuild

xcodebuild 是苹果发布自动构建的工具,

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
定位到工程目录下,执行 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,因此在编译时使用了 -workspace,并指定所需要build的 Configuration 和 Scheme,如下:

xcodebuild -workspace SAUserModuleTest.xcworkspace -configuration Cit -scheme SAUserModuleEnterprise
编译过程中会打印诸多编译信息,不出错的话基本没必要看所打印的信息(太多啦),下面展示一张出错的图:

build_failed.png

改错,再来一遍!Again!!!

Build_Success.png

Success!!!

libimobiledevice

官方github地址:https://github.com/libimobiledevice/libimobiledevice


未完,待续~~

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容