CFBundleVersion error in Xcode 10.2.1 after installing Xcode 11 beta 1

When trying to build and run a target, or executing unit tests, an alert appears with the title, "Failed to install the requested application" and the description, "The application's CFBundleVersion is invalid." This started shortly after installing the first beta of Xcode 11 on a machine that already had an installation of Xcode 10.2.1.


The Xcode 11 beta 1 release notes state, "Bundles without a CFBundleVersion are invalid and can’t be properly installed on devices or simulators. CoreSimulator now checks and rejects such bundles earlier in the process with a clearer error message. (49892531)"


The targets in question do have CFBundleVersions. However, using agvtool to set a new bundle version seems to resolve the issue (at least temporarily):


agvtool new-version -all 2


Has anybody else run into this?

Replies

I am also facing the same issue when migrating from Xcode 10.1 to Xcode 10.2.1, any solutions to it ?

As a workaround, following these steps seems to work:


  1. From your project's root directory run agvtool, giving it whichever version number you want: agvtool new-version -all 2
  2. From the Simulator choose Hardware > Erase All Content And Settings…
  3. Build and run your target again.


I've been having to repeat this process every time I want to switch between running the app in the simulator and executing unit tests, and sometimes when switching branches.


I should also note that this project uses an unsupported version pattern which looks like 3.2.1-1, which is probably the root of the problem. CFBundleVersion's documentation clearly states it requires a "…string composed of one to three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods."


I don't understand why changing the CFBundleVersion to something like 2 doesn't resolve the issue entirely though. Or why these steps are necessary when swtiching between running and testing.

I have multiple Xcode versions , I did


sudo xcode-select -switch /Applications/Xcode_10.1.app

agvtool new-version -all 2


I see below error.

`xcrun: error: unable to find utility "avgtool", not a developer tool or in PATH`


I also see below error as well, I am on the project root dorectory..



There are no Xcode project files in this directory. agvtool needs a project to operate.

Hi , I was able to fix the issue by following below steps


The steps that finally fixed the problem and allowed me to install on simulator:

  1. Quit Xcode and iOS Simulator
  2. Remove
    /Library/Developer
    (the one from root), or rename it if you want to keep a backup
  3. Relaunch Xcode, agree with the installation of command line tools
  4. Continue work where you left over 🙂

Besides the steps mentioned in the question (fully uninstall Xcode 11, fully uninstall Xcode 10 and reinstall it afterwards), I also tried cloning the project in another location, circulating through all possible locations for derived data, installing other simulator runtimes and trying on those. None of them worked, luckily the console log app shown the path for the process that rejected the app bundle, it was one of the binaries installed by Xcode in

/Library/Developer/PrivateFrameworks/CoreSimulator.framework
.

Seems that Xcode 11 installed a newer version of the frameworks, and Xcode 10 was not overwriting them. Removing the whole

/Library/Developer
folder triggered the command line tools installation, which finally brought back the simulator runtime that properly worked in Xcode 10.

just reset the simulator (Hardware > Erase all contents and settings)

bvenkatnarayansetty, it would've been nice to give attribution to the source from where you literally copy+pasted the answer (https://stackoverflow.com/a/56481486/1974224)