Last active
November 3, 2015 18:17
-
-
Save jkubicek/ff54b173812f5b4bac21 to your computer and use it in GitHub Desktop.
Fix embedded framework version numbers
This file contains 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
# Add this script as a build phase in your project. It will update | |
# all embeded framework marketing versions and build version to be | |
# equal to the marketing and build version in your main app. | |
# More details: | |
# https://github.com/Carthage/Carthage/issues/859 | |
# https://forums.developer.apple.com/thread/23778 | |
PLIST_PATH=$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH | |
PLIST_PATH=$(dirname $PLIST_PATH)/$(basename $PLIST_PATH .plist) | |
SHORT_VERSION=$(defaults read $PLIST_PATH CFBundleShortVersionString) | |
VERSION=$(defaults read $PLIST_PATH CFBundleVersion) | |
echo "Changing all framework versions to $SHORT_VERSION ($VERSION)" | |
cd $BUILT_PRODUCTS_DIR | |
for i in `find -L *.framework *.framework.dSYM -name "*.plist"`; do | |
plutil -replace 'CFBundleShortVersionString' -string $SHORT_VERSION $i | |
plutil -replace 'CFBundleVersion' -string $VERSION $i | |
echo "Replacing versions in file: " $i | |
done; |
Updated the find command to follow symlinks. When archiving, the frameworks are symlinked from the build directory.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated the script. Previously I was updating the Info.plist files after they had already been embedded in the app. This breaks code signing for installing on a local device. Code signing for remote distribution worked because iTunes Connect re-signs the binary, which is why I didn't notice this issue yesterday.