xcodearchivexcodebuild

xcodebuild archive: set version number and build number


I'm writing a bash script to archive and export my project so I can send it to iTunes Connect. However, the documentation from the command line is a little confusing. I'm trying to figure out if there's a way to pass a parameter to the xcodebuild command that would set the version number and build number for that archive (similar to how you pass -scheme MyScheme when calling xcodebuild). Anyone done something like this before?

Thanks!


Solution

  • You can use this:

    /usr/libexec/Plistbuddy -c "Set CFBundleVersion $SBUILD_NUMBER" "$PLIST"
    /usr/libexec/Plistbuddy -c "Set CFBundleShortVersionString $BUNDLE_SHORT_VERSION" "$PLIST"
    

    with PLIST is the path to your Info.plist