Xcode “Build and Archive” from command line

前端 未结 20 1282
死守一世寂寞
死守一世寂寞 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 14:00

    I've been using my own build script to generate the ipa package for ad hoc distribution.

    die() {
        echo "$*" >&2
        exit 1
    }
    
    appname='AppName'
    config='Ad Hoc Distribution'
    sdk='iphoneos3.1.3'
    project_dir=$(pwd)
    
    echo using configuration $config
    
    echo updating version number
    agvtool bump -all
    fullversion="$(agvtool mvers -terse1)($(agvtool vers -terse))"
    echo building version $fullversion
    
    xcodebuild -activetarget -configuration "$config" -sdk $sdk build || die "build failed"
    
    echo making ipa...
    # packaging
    cd build/"$config"-iphoneos || die "no such directory"
    rm -rf Payload
    rm -f "$appname".*.ipa
    mkdir Payload
    cp -Rp "$appname.app" Payload/
    if [ -f "$project_dir"/iTunesArtwork ] ; then
        cp -f "$project_dir"/iTunesArtwork Payload/iTunesArtwork
    fi
    
    ipaname="$appname.$fullversion.$(date -u +%Y%m%d%H%M%S).ipa"
    zip -r $ipaname Payload
    
    echo finished making $ipaname
    

    The script also increment the version number. You can remove that part if it's not needed. Hope it helps.

提交回复
热议问题