Joseph Lin
Joseph Lin

Reputation: 3334

iOS Extension: Is it necessary to increment its bundle version (CFBundleVersion)?

Do I have to increment the the CFBundleVersion in my extension's Info.plist to ensure it overwrites existing ones? Or if doing so in the main app's Info.plist is enough?

I'm working on today extension, but I guess the question applies to all embedded binaries.

Upvotes: 12

Views: 6880

Answers (6)

weiran
weiran

Reputation: 735

Building on @atomkirk's answer, in my apps the version and build numbers are set in the xcodeproject. So instead of I need to use xcodebuild to pull out the relevant values:

buildNumber=$(xcodebuild -showBuildSettings -project App.xcodeproj | pcregrep -o1 "PROJECT_VERSION = ([0-9a-f\-]+)")
marketingVersion=$(xcodebuild -showBuildSettings -project App.xcodeproj | pcregrep -o1 "MARKETING_VERSION = ([0-9a-f\-.]+)")

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$SRCROOT/Share Extension/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $marketingVersion" "$SRCROOT/Share Extension/Info.plist"

Upvotes: 1

atomkirk
atomkirk

Reputation: 3801

To avoid the warning from iTunes Connect, I just bump all the version numbers from my "Bump build number" build script of my main app:

if [ "$BUMP_BUILD_NUMBER" = "1" ] ; then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${INFOPLIST_FILE}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "/Users/name/project/ios/Siri/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "/Users/name/project/ios/SiriUI/Info.plist"
fi
``

Upvotes: 5

oskarko
oskarko

Reputation: 4188

Yeah, extensions bundle versions (bundle version && bundle version string, short) have to mismatch to main app build && version.

so, bundle version extension = main app build

bundle version string, short = main app version

Upvotes: 0

SagarScript
SagarScript

Reputation: 1252

I've just been looking for the same answer, I've just recently updated an app and found that upon upload, I was presented with a warning regarding the extensions and the version numbers mismatching with the app or something, (can't remember the specific wording) - hence why I am here!

"App Extensions and their containing apps must use the same build number (CFBundleVersion) and version number (CFBundleShortVersionString) as used in the other targets in the Xcode project."

Not much information but it's clear - the versions of App extensions and WatchKit extensions must match the same version as the application they are in.

Seem's a bit pointless even giving us an option to specify separate version numbers, no?

Upvotes: 1

Daniel Galasko
Daniel Galasko

Reputation: 24257

I think Apple would actually prefer App Extensions to use the same bundle version as the app they are contained in. This is the email I have been getting from iTunes Connect with every submission:

We have discovered one or more issues with your recent delivery for "Awesome App". Your delivery was successful, but you may wish to correct the following issues in your next delivery:

CFBundleVersion Mismatch - The CFBundleVersion value '94' of extension 'Awesome App.app/PlugIns/Awesome App Today Extension.appex' does not match the CFBundleVersion value '99' of its containing iOS application 'Awesome App.app'.

CFBundleShortVersionString Mismatch - The CFBundleShortVersionString value '1.0' of extension 'Awesome App.app/PlugIns/Awesome App Today Extension.appex' does not match the CFBundleShortVersionString value '1.3.0' of its containing iOS application 'Awesome App.app'.

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.

I can ignore these warnings and the build passes review but this is either a bug in iTunes Connect or the numbers should be the same. This doesn't actually make sense since the extension won't necessarily be updated at the same rate of the app. Anyways

Upvotes: 13

Tom Harrington
Tom Harrington

Reputation: 70976

It's not documented either way, so you should update it. It might not matter, but you can't be certain, and even if it's not necessary now it might become necessary later on. As an undocumented detail, it could change without warning.

It's also just good software development practice. The embedded version number should change whenever the extension changes, even if iOS doesn't do anything with the information.

Upvotes: 7

Related Questions