Skip to content

Instantly share code, notes, and snippets.

@jkubicek
Last active November 3, 2015 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkubicek/ff54b173812f5b4bac21 to your computer and use it in GitHub Desktop.
Save jkubicek/ff54b173812f5b4bac21 to your computer and use it in GitHub Desktop.
Fix embedded framework version numbers
# 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;
@jkubicek
Copy link
Author

jkubicek commented Nov 3, 2015

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.

@jkubicek
Copy link
Author

jkubicek commented Nov 3, 2015

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