美文网首页
xcodebuild自动脚本打包.md

xcodebuild自动脚本打包.md

作者: BenXian | 来源:发表于2017-06-17 18:27 被阅读140次

    步骤

    archive包

    xcodebuild archive -workspace 项目名称.xcworkspace -scheme 项目名称  -configuration 构建配置  -archivePath archive包存储路径  CODE_SIGN_IDENTITY=证书 PROVISIONING_PROFILE=描述文件UUID
    
    

    -workspace 这个就是项目名
    -scheme 可以通过xcodebuild -list
    获取
    -configration 一些参数,也可以通过xcodebuild -list
    获取,一般使用DebugRelease
    -archivePath archive后的路径
    CODE_SIGN_IDENTITY 证书的Inentity
    PROVISIONING_PROFILE 描述文件UUID

    来看看xcodebuild -list
    吧,看看怎么获取scheme和configration

    
    Information about project "ThreeDTouchTest": Targets: ThreeDTouchTest ThreeDTouchTestTests ThreeDTouchTestUITests Build Configurations: Debug Release If no build configuration is specified and -scheme is not passed then "Release" is used. Schemes: ThreeDTouchTest
    
    

    如果不需要特定去指定证书和Provisioning文件,那可以省略上面这两个参数也可以。不过还是得说一下这两参数怎么获取:

    证书Identity获取:
    打开你的钥匙串访问->选中其中一个证书->右键->显示简介,把标题复制出来就可以了。

    格式是:

    iPhone Distribution: Beijing xxoo yyooxx Technology Service CO., Ltd. (UA11AAJJKK8)

    [图片上传中。。。(1)]

    获取Provisioning文件UUID
    在xcode8.0以上,Provisioning文件的位置是:

    /Users/用户名/Library/MobileDevice/Provisioning Profiles

    在终端上面进入的文件夹。使用/usr/bin/security
    可以把Provisioning文件解密

    /usr/bin/security cms -D -i 098a87e3-11fe-463d-75aa-12345678adba.mobileprovision
    
    

    在终端输出整个plist文件,里面包含着所有的信息
    对了,还有这个命令可以查看项目设置:

    xcodebuild -target <target> -configuration <configuration> -showBuildSettings
    
    

    ipa包

    xcodebuild -exportArchive -archivePath archive文件的地址.xcarchive -exportPath 导出的文件夹地址  -exportOptionsPlist exprotOptionsPlist.plist  CODE_SIGN_IDENTITY=证书 PROVISIONING_PROFILE=描述文件UUID
    
    

    exportOptionsPlist.plist文件内容:

    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    
        <plist version="1.0">
    
        <dict>
    
            <key>teamID</key>
    
            <string>UA11AAJJKK8</string> //TeamID
    
            <key>method</key>
    
            <string>ad-hoc</string> //ad-hoc打包
    
            <key> compileBitcode</key> //是否编译bitcode
    
            <false/>
    
        </dict>
    
        </plist>
    
    

    字段解析:

    Available keys for -exportOptionsPlist: compileBitcode : Bool For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES. embedOnDemandResourcesAssetPacksInBundle : Bool For non-App Store exports, if the app uses On Demand Resources and this is YES, asset packs are embedded in the app bundle so that the app can be tested without a server to host asset packs. Defaults to YES unless onDemandResourcesAssetPacksBaseURL is specified. iCloudContainerEnvironment For non-App Store exports, if the app is using CloudKit, this configures the "com.apple.developer.icloud-container-environment" entitlement. Available options: Development and Production. Defaults to Development. manifest : Dictionary For non-App Store exports, users can download your app over the web by opening your distribution manifest file in a web browser. To generate a distribution manifest, the value of this key should be a dictionary with three sub-keys: appURL, displayImageURL, fullSizeImageURL. The additional sub-key assetPackManifestURL is required when using on demand resources. method : String Describes how Xcode should export the archive. Available options: app-store, ad-hoc, package, enterprise, development, and developer-id. The list of options varies based on the type of archive. Defaults to development. onDemandResourcesAssetPacksBaseURL : String For non-App Store exports, if the app uses On Demand Resources and embedOnDemandResourcesAssetPacksInBundle isn't YES, this should be a base URL specifying where asset packs are going to be hosted. This configures the app to download asset packs from the specified URL. teamID : String The Developer Portal team to use for this export. Defaults to the team used to build the archive. thinning : String For non-App Store exports, should Xcode thin the package for one or more device variants? Available options: <none> (Xcode produces a non-thinned universal app), <thin-for-all-variants> (Xcode produces a universal app and all available thinned variants), or a model identifier for a specific device (e.g. "iPhone7,1"). Defaults to <none>. uploadBitcode : Bool For App Store exports, should the package include bitcode? Defaults to YES. uploadSymbols : Bool For App Store exports, should the package include symbols? Defaults to YES.
    
    

    以i-Synergy为例:

    xcodebuild archive -workspace GuoBangCleaner.xcworkspace -scheme GuoBangCleaner -configuration Release -archivePath /Users/xian/Desktop/archive
    
    
    xcodebuild -exportArchive -archivePath /Users/xian/Desktop/archive.xcarchive -exportPath /Users/xian/Desktop/archive -exportOptionsPlist /Users/xian/Documents/iOSWorkspace/GuoBang/guobangcleaner/exprotOptionsPlist.plist
    
    

    相关文章

      网友评论

          本文标题:xcodebuild自动脚本打包.md

          本文链接:https://www.haomeiwen.com/subject/fsziottx.html