Xcode “Build and Archive” from command line

前端 未结 20 1283
死守一世寂寞
死守一世寂寞 2020-11-22 13:52

Xcode 3.2 provides an awesome new feature under the Build menu, \"Build and Archive\" which generates an .ipa file suitable for Ad Hoc distribution. You can also open the O

20条回答
  •  孤城傲影
    2020-11-22 13:56

    The xcodebuild tool can build and export archive products with the -exportArchive flag (as of Xcode 5). The export step was previously only possible via the Xcode Organizer UI.

    First archive your app:

    xcodebuild -scheme  archive
    

    Given $ARCHIVE_PATH (the path to the .xcarchive file), export the app from the archive with one of the following:

    iOS .ipa file:

    xcodebuild -exportArchive -exportFormat ipa -archivePath "$ARCHIVE_PATH" -exportPath "myApp.ipa" -exportProvisioningProfile "My App Provisioning profile"
    

    Mac .app file:

    xcodebuild -exportArchive -exportFormat app -archivePath "$ARCHIVE_PATH" -exportPath "myApp.app" -exportSigningIdentity "Developer ID Application: My Software Company"
    

    In both commands the -exportProvisioningProfile and -exportSigningIdentity arguments are optional. man xcodebuild for details on the semantics. In these examples, the provisioning profile for the iOS build specified an AdHoc distribution provisioning profile, and the signing identity for the Mac app specified a Developer ID for export as a 3rd party application (i.e. not distributed via the Mac App Store).

提交回复
热议问题