Xcode 13 app archiving is modifying framework plist

When archiving & exporting App with Xcode 13. The Frameworks of the created app will have their Info.plist modified. CFBundleShortVersionString is being changed to have the same value as the application version.

Steps to reproduce:

  1. Create iOS App project with v1.0.0

  2. Add dynamic framework dependencies. ex: Framework A v3.0.0, Framework B v12.0.0.

  3. Archive Project.

  4. Distribute app AppStore Connect

  5. Export

  6. Finish the rest of the process with default values.

  7. Investigate generated IPA file

  8. Investigate .app file inside IPA

  9. Investigate frameworks inside .app file.

  10. CFBundleShortVersionString of all the frameworks is 1.0.0

Post not yet marked as solved Up vote post of JumioAustria Down vote post of JumioAustria
17k views
  • framework developer here - anyone know how to get back the framework's version in the cases of stubborn app developers at the company who refuse to set manageAppVersionAndBuildNumber to false?

  • Need a way to disable it for frameworks. Any help here?

Add a Comment

Replies

Hey, in the company I work for we were also facing this issue. It had a very bad side effect on our release, because all third party frameworks had their CFBundleShortVersionString replaced by our app CFBundleShortVersionString in the process of archiving and generating an IPA when using Xcode 13, and some of those third parties rely on their framework version number to be sent on networking calls for them to behave properly.

The solution for us was to specifically set manageAppVersionAndBuildNumber on the -exportOptionsPlist for xcodebuild, or in our case more specifically via Fastlane's gym export-options property, to false. It seems manageAppVersionAndBuildNumber is a new export option introduced for xcodebuild on Xcode 13, that when set as YES (its default) ends up having this unexpected side effect.

From xcodebuild -help:

Available keys for -exportOptionsPlist:

manageAppVersionAndBuildNumber
        Should Xcode manage the app's build number when uploading to App Store Connect? Defaults to YES.

We are not 100% sure if manageAppVersionAndBuildNumber was indeed introduced on Xcode 13, but in case it was already there, then there was a change in behavior since exporting on Xcode 12.* works just fine without it.

The Xcode 13 release notes doesn't seem to have have any details about it, and we didn't find any other official Apple statement mentioning that as well :/. Would be great to have someone from Apple confirming this.

I hope that helps! 🤞

  • Lifesaver! Thank you, this worked for me.

  • Thank you so much, this is very helpful.

Add a Comment

Automatic version number management is new to Xcode 13. These additions were detailed in a WWDC session, as well as the Xcode 13 Release Notes:

When uploading an app to App Store Connect, the distribution assistant in Xcode detects whether your app has a valid build number (CFBundleVersion). If your app has an invalid number (like one that was used previously, or precedes your current build number), the distribution assistant provides an option to automatically increment it to a valid number. In addition, the distribution assistant ensures that the build numbers of all embedded content in your app (such as app extensions, App Clips, or watchOS apps) are in sync with your app. Note that this doesn’t modify your source code or your archive; Xcode updates the build number in a staged copy of your app before packaging and uploading it to App Store Connect. (59826409)

Thanks, @edford.

We noticed this addition in the release notes, but quite honestly it only mentions CFBundleVersion that stands for the build number, there's nothing about CFBundleShortVersionString being also changed by the distribution assistant. If the assistant would change the version number of the main app, in case that is invalid, it would be reasonable IHMO, however changing the version number of all embedded content of an app doesn't seem to make much sense.

Would be great if the release notes were clear about that, in case it is an intentional behavior. I couldn't find anything specifically mentioning the new xcodebuild export option as well, which would be also great to have.

Unfortunately I didn't have the chance to check that WWDC session video, but thanks a lot for mentioning it. I'd expect though that the notes would give all clarity needed.

this SO answer shows a screenshot of how to disable it using the Xcode 13 UI

https://stackoverflow.com/questions/68237292/manage-version-and-build-number/69562078#69562078

  • I don't see any screenshot on that link. Do you mind posting here where to disable it in the XCode UI?

Add a Comment

This change brakes our framework's internal logic because of changing it's version.

In my case, option - manageAppVersionAndBuildNumber doesn't work in Jenkins flow ....

  • Could you fix it in the Jenkins flow?

Add a Comment

Is there a way to disable it on xcode?

This is still happening in Xcode 14 where it's not just changing the app bundle's plist, but also every embedded framework's plist, which breaks various vendor SDKs that relying on reading the plist to share what version of their SDK is being use. Arguable as to whether that is best practice, but it does feel like this shouldn't touch anything other than the app bundle's plist and not change the values for any dynamic frameworks.

Is this a bug or change we should file something in Feedback Assistant for?

Was this behavior ever modified? We have third party vendor frameworks that seem to rely on reading its own plist to determine the version, and unless this Xcode feature is disabled or fixed so it doesn't rewrite dynamic framework plists, the behavior of the framework turns incorrect.