I’ve been using plistbuddy for years. Now, when trying to compile my app in Xcode, when executing the shells script as part of the build, plistbuddy reports that the key “CFBundleVersion” doesn’t exit.
I’m printing the $PROJECT_DIR value and the $INFO_PLIST value. The $INFO_LIST does exist in the $PROJECT_DIR and the file contains the CFBundleVersion:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleHelpBookFolder</key>
<string>FSHelp</string>
<key>CFBundleHelpBookName</key>
<string>File Synchronization Help</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string><HIDDEN></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>FSYN</string>
<key>CFBundleVersion</key>
<string>318</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSHasLocalizedDisplayName</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
CFBundleVersion
318
Here is my script:
echo -n "PROJECT_DIR: ${PROJECT_DIR}"
echo -n "INFOPLIST_FILE: ${INFOPLIST_FILE}"
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
Here is the output:
Command PhaseScriptExecution failed with a nonzero exit code
PROJECT_DIR: /Users/laurent/Documents/Development/Personal/Mac OS X Projects/File Synchronization
INFOPLIST_FILE: File Synchronization Apps Store-Info.plist
Print: Entry, "CFBundleVersion", Does Not Exist
So, what’s going on?