IOS automatic packaging upload step pit record

Add open source libraries that use Python to package commands (bottom ~) 2016-06-06-1. After a round of testing, I found some mistakes in the article, so I modified it a little and added command 4Copy the code

Every time I want to export a package, I have to open XCode, click product-Archive, wait for several minutes for various builds, and then manually upload to AppStore, even upload to Dandelion, FIR, etc…

I read a lot of articles about iOS automatic packaging IPA a long time ago. It felt very simple, but because THERE was no AppleDeveloper account for me to use, when it was really time to do automatic packaging, I found that there were pits everywhere.

Basic commands

  1. Generated xcedebuild:Archive, exportipaAnd other features…
  2. Xcrun:*.appPackaged inipaAnd other features…

The basic use

Xcedebuild package Archive file

xcedebuild -workspace ${path to *.xcworkspace} -scheme ${scheme} -destination generic/platform=iOS archive -configuration Release ONLY_ACTIVE_ARCH=NO -archivePath ${export path *.xcarichive}
Copy the code
  • – the workspace you*.xcworkspacefile
  • – Scheme in the project filescheme
  • – archivePath generated*.xcarichiveThe file path

Xcedebuild exports ipA from *. Xcarchive

xcodebuild -exportArchive -exportFormat IPA -archivePath ${path to *.xcarchive} -exportPath ${export path *.ipa} -exportProvisioningProfile ${ProvisioningProfileName}
Copy the code
  • – archivePath you*.xcarchiveFile, which can be exported using the previous command
  • – exportPath exportedipaThe path
  • ExportProvisioningProfile your Distribution to release the name of the certificate (only need name)

Xcrun package IPA

xcrun -sdk iphoneos PackageApplication -v ${path to *.app} -o ${package path *.ipa}
Copy the code
  • The -v you*.appFile, generated*.xcarchiveThere is a
  • -o Generated by packaging*.ipaFile path, attention!! The relative path cannot be specified because the path environment variable is not the current path of the command

4. The latest correct XcodeBuild export IPA

xcodebuild -exportArchive -archivePath ${path to *.xcarchive} -exportPath ${export path to dir} -exportOptionsPlist ${path to export options *.plist}
Copy the code
  • – archivePath you*.xcarchiveFile, which can be exported using the second command
  • – exportPath exportedipaDirectory, the ipA name seems to be the name of Scheme
  • -exportOptionsPlist Exports the configuration file in PLIST format

ExportOptionPlist: creates a plist file containing a Dictionary. The key-values are optional and do not need to be filled in

  1. compileBitcode: Bool

    For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES.

  2. 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.

  3. iCloudContainerEnvironment

    For non-App Store exports, if the app is using CloudKit, This configures the “com. Apple. Developer. Up to the container – environment” entitlement. The Available options: Development and Production. Defaults to Development.

  4. 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.

  5. 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.

  6. 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.

  7. teamID : String

    The Developer Portal team to use for this export. Defaults to the team used to build the archive.

  8. thinning : String

    For non-App Store exports, should Xcode thin the package for one or more device variants? Available options: (Xcode produces a non-thinned universal app), (Xcode produces a universal app and all available thinned variants), Or a model identifier for a specific device (e.g. “iPhone7,1”). Defaults to.

  9. uploadBitcode : Bool

    For App Store exports, should the package include bitcode? Defaults to YES.
    Copy the code
  10. uploadSymbols : Bool

    For App Store exports, should the package include symbols? Defaults to YES.

Hit the pit

A pit

Before using the first command, make sure your project’s signature is configured and the certificate is up to date

Pit 2

The second command – exportProvisioningProfile fill is your release certificate name, isn’t it a bunch of id

Three pit

*. Ipa cannot be used to upload to AppStore. The third party library in CocoaPods was signed incorrectly

Pit four

If the packaged *. Ipa needs to be uploaded to AppSotre, a third command, xcrun, can be used

Pit five

Use the third command to package the *. Ipa, upload it to AppStore, log in to iTunes Connect-APP- All Builds to see the uploaded *. Ipa is being built. After a while, however, your AppleDeveloper account will receive an email indicating that a SwiftSupport folder is missing from your *. Ipa package

After various searches, the original need to package xcRun *. Ipa decompress, and then create a new folder, *. Xcarchive inside SwiftSupport folder copy into, and then decompress ipA move into, finally make a zip package, If you change the suffix to IPA, you can upload it to AppStore.

6 the pit

After a round of testing, I found that you need to add SwiftSupport files to the package using the xcrun command. Actually, there is a command that is not so troublesome.

Use the fourth command above to export the IPA with *.xcarchive. The exported ipA will contain SwiftSupport, so you don’t need to add it yourself

Set pieces

After hitting the fifth pitfall, I found an iOS package, release library on Github… Address: github.com/nomad/shenz… Lazy to make their own can use this library, feeling or quite good

Python encapsulates the package command

github: package-ipa


This article is an original article by blogger Skytoup and shall not be reproduced without permission of blogger Skytoup.Copy the code