iOS自动化打包

从这个报错开始xcodebuild: error: invalid option ‘-exportFormat’说起吧。

  • 产生原因:x-code8之后,对之前的exportFormat方式不在支持了,所以报错。之前的老方式
    archive_dir = archive的地址
    ipa_dir = 生成ipa的地址 e.g. x/x/x.ipa
    PROVISIONING_PROFILE = 签名 e.g. x_dev.mobileprovision 为x_dev

    xcodebuild -exportArchive -exportFormat IPA -archivePath ' + archive_dir() + ' -exportPath ' + ipa_dir + ' -exportProvisioningProfile ' + PROVISIONING_PROFILE + '
  • 修改方法:
    干掉exportFormat IPA 引入exportOptionsPlist

    xcodebuild -exportArchive -exportOptionsPlist ' + OPTIONS_LIST_PATH +' -archivePath ' + archive_dir() \
    + ' -exportPath ' + ipa_dir() + ' PROVISIONING_PROFILE_SPECIFIER= ' + PROVISIONING_PROFILE 

    接下来研究一下exportOptionsPlist,直接食用xcodebuild -help查看。

    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.

    接下来就很清晰了。
    来个例子

    <?xml version="1.0" encoding="UTF-8"?>
    <!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>xxxxxxx</string>
    <key>method</key>
    <string>ad-hoc</string>
    <key>compileBitcode</key>
    <false/>
    </dict>
    </plist>
    

    teamID通过x-code自找填入就可以。key一定区分大小写。teamID至关重要,打包会通过teamID找签名文件,默认为dev的teamID,如果配置的dev和ad_hoc,relese,appStore的bundleID不一致,一直会报错。

    XCode - No Provisioning profiles matching an applicable Signing identity were found
中途遇到报错:
Embedded binary is not signed with the same certificate as the parent app.
  • 这个问题在于我使用extension,两者配置的有偏差,主要在于一个为dev,另外一个dis这种错误。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值