Created
February 23, 2017 23:04
-
-
Save ericrwolfe/3c919e469b79a913eb17c04dc84b4a9a to your computer and use it in GitHub Desktop.
Xcode run script build phase to deal with Mapbox access tokens
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
token_file=~/.mapbox | |
token=`cat $token_file` | |
info_plist=$TARGET_BUILD_DIR/$INFOPLIST_PATH | |
current_token=`/usr/libexec/PlistBuddy -c "Print :MGLMapboxAccessToken" $info_plist` | |
if [ "$current_token" ]; then | |
exit 0 | |
elif [ "$token" ]; then | |
plutil -replace MGLMapboxAccessToken -string $token $info_plist | |
else | |
echo 'error: Missing Mapbox access token' | |
open 'https://www.mapbox.com/studio/account/tokens/' | |
echo "error: Get an access token from <https://www.mapbox.com/studio/account/tokens/>, then create a new file at $token_file that contains the access token." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment