Cannot run application on simulator after installing Xcode 11 - CFBundleVersion error

后端 未结 16 1353
醉梦人生
醉梦人生 2020-12-15 02:50

Yesterday, I\'ve downloaded beta version of Xcode 11. After that, I\'ve opened my project and tried to run with new Xcode. Unfortunately error has occurred with message:

相关标签:
16条回答
  • 2020-12-15 03:08

    In my case, the "Build Version" field on my target was empty, I changed it to 1 and the app was able to install.

    0 讨论(0)
  • 2020-12-15 03:10

    In my case, the Build Version field was empty. I added the value there but still it didn't work. I tried killall -9 CoreSimulatorBridge command and that also didn't help. Finally when I checked the xml of the info.plist (Open as -> Source code), the CFBundleVersion key was not present and the version was displayed in the info.plist through CFBundleShortVersionString.

    I just added the CFBundleVersion key as given below in the info.plist and it worked.

    <key>CFBundleVersion</key> <string>$(MARKETING_VERSION)</string>

    I hope it helps someone else too.

    0 讨论(0)
  • 2020-12-15 03:11

    I had the same problem. I find the Xcode 11 Beta Release Notes had explain it.

    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)
    

    And this link is the format of CFBundleVersion.

    When I resolved this problem, I found out if having the CFBundleVersion problem when running App for the first time. Then it always has problem no matter whether the format is correct or not. So I restart the Xcode and the Simulator, and change the CFBundleVersion to a correct format, the App running correctly.

    0 讨论(0)
  • 2020-12-15 03:12

    I went to targets and found "Version" field is empty, just fill a number, for example 1.0

    0 讨论(0)
  • 2020-12-15 03:17

    Happened to me too, wasted almost an entire day scouting for possible causes.

    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.

    You gotta love the betas :)

    0 讨论(0)
  • 2020-12-15 03:18

    Combining Sgeven.Zheng and Cristik's answers.

    CAUSE

    Installing Xcode11 Beta installs a new version of CoreSimulator.framework with the following update:

    https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_release_notes

    "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 following won't fix the issue:

    • Uninstalling Xcode11 Beta
    • Uninstalling and reinstalling Xcode 10

    This is because CoreSimulator.framework is installed in /Library/Developer/PrivateFrameworks/CoreSimulator.framework, which is outside the Xcode.app bundle. When re-installed, xcode10 detects that the currently installed version of CoreSimulator.framework is newer than what xcode10 would have installed, so it leaves it as-is.

    SHORT-TERM FIX

    1. Uninstall xcode11
    2. Install Xcode 10 (No need to re-install if it's already installed)
    3. Remove /Library/Developer/PrivateFrameworks/CoreSimulator.framework
    4. Launch Xcode 10 and agree to install command line tools

    LONG-TERM FIX

    Since this is not a "real" bug but is instead the intended behavior of Xcode11, steps will eventually need to be taken to ensure that apps are always built with a valid CFBundleVersion.

    0 讨论(0)
提交回复
热议问题