Can an Xcode .mobileprovision file be 'installed' from the command line?

后端 未结 7 1290
野的像风
野的像风 2020-12-22 18:47

I\'m trying to automate the process of building apps for our clients using bash scripts running on a Mac Mini Server (OSX 10.7).

My script is based on the spectacul

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-22 19:39

    A compendium of all other answers update_provisioning_profile.sh:

    #!/bin/sh
    #
    # Download and install a single iOS provisioning profile
    # Requires https://github.com/nomad/cupertino
    #
    # Usage
    # - Login to your account once:
    # ios login
    # - Configure TEAM and PROFILE (instructions below)
    # - Run update_provisioning_profile.sh at anytime, usually after adding/removing devices to the profile
    
    # Configure the team identifier
    # Copy it from developer portal or just use cupertino to get it:
    # ios devices
    # Copy the string in parens and set it as TEAM
    TEAM="team id"
    
    # Configure the profile name you want to manage
    # Copy it from developer portal or use cupertino to get a list (ignoring Xcode managed profiles):
    # ios profiles --team ${TEAM} | grep -v 'iOS Team Provisioning Profile'
    # Copy the name as-is and set as PROFILE
    PROFILE="profile name"
    
    # Fetch the profile using `cupertino` tool
    # you need to run `ios login` once to setup the account
    ios profiles:download "${PROFILE}" --team ${TEAM}
    PROFILE_FILE=`echo $PROFILE | tr ' ' '_'` # `cupertino` tool will replace spaces with _
    UUID=`/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< $(security cms -D -i ${PROFILE_FILE}.mobileprovision)`
    
    # copy where Xcode can find it
    cp ${PROFILE_FILE}.mobileprovision "$HOME/Library/MobileDevice/Provisioning Profiles/${UUID}.mobileprovision"
    
    # clean
    rm ${PROFILE_FILE}.mobileprovision
    

    Easy to adapt to your provisioning needs.

提交回复
热议问题