XCode 13 - 应用程序的 Info.plist 不包含有效的 CFBundleVersion

XCode 13 - The application's Info.plist does not contain a valid CFBundleVersion

我试图在 XCode 13 中启动一个旧的 ios 应用程序,但在构建失败后它一直给我这个错误:

Details

Failed to install the requested application
Domain: NSPOSIXErrorDomain
Code: 22
Failure Reason: The application's Info.plist does not contain a valid CFBundleVersion.
Recovery Suggestion: Ensure your bundle contains a valid CFBundleVersion.
User Info: {
    IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher;
    bundleURL = "file:///Users/lukas/Library/Developer/Xcode/DerivedData/zidane-cugshiqqzwkexrgiylyvxcagbylt/Build/Products/Vedur_Dev-iphonesimulator/zidane.app/";
}
--

Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_model" = "iPhone10,4";
    "device_osBuild" = "15.0 (19A339)";
    "device_platform" = "com.apple.platform.iphonesimulator";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = "x86_64";
    "operation_duration_ms" = 87;
    "operation_errorCode" = 22;
    "operation_errorDomain" = NSPOSIXErrorDomain;
    "operation_errorWorker" = IDELaunchiPhoneSimulatorLauncher;
    "operation_name" = IDERunOperationWorkerGroup;
    "param_consoleMode" = 0;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 3;
    "param_destination_isProxy" = 0;
    "param_destination_platform" = "com.apple.platform.iphonesimulator";
    "param_diag_MainThreadChecker_stopOnIssue" = 0;
    "param_diag_MallocStackLogging_enableDuringAttach" = 0;
    "param_diag_MallocStackLogging_enableForXPC" = 1;
    "param_diag_allowLocationSimulation" = 1;
    "param_diag_gpu_frameCapture_enable" = 0;
    "param_diag_gpu_shaderValidation_enable" = 0;
    "param_diag_gpu_validation_enable" = 0;
    "param_diag_memoryGraphOnResourceException" = 0;
    "param_diag_queueDebugging_enable" = 1;
    "param_diag_runtimeProfile_generate" = 0;
    "param_diag_sanitizer_asan_enable" = 0;
    "param_diag_sanitizer_tsan_enable" = 0;
    "param_diag_sanitizer_tsan_stopOnIssue" = 0;
    "param_diag_sanitizer_ubsan_stopOnIssue" = 0;
    "param_diag_showNonLocalizedStrings" = 0;
    "param_diag_viewDebugging_enabled" = 1;
    "param_diag_viewDebugging_insertDylibOnLaunch" = 1;
    "param_install_style" = 0;
    "param_launcher_UID" = 2;
    "param_launcher_allowDeviceSensorReplayData" = 0;
    "param_launcher_kind" = 0;
    "param_launcher_style" = 0;
    "param_launcher_substyle" = 0;
    "param_runnable_appExtensionHostRunMode" = 0;
    "param_runnable_productType" = "com.apple.product-type.application";
    "param_runnable_swiftVersion" = "5.5";
    "param_runnable_type" = 2;
    "param_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphonesimulator15.0";
    "sdk_osVersion" = "15.0";
    "sdk_variant" = iphonesimulator;
}
--


System Information

macOS Version 11.6 (Build 20G165)
Xcode 13.0 (19234) (Build 13A233)
Timestamp: 2021-10-06T08:33:19Z

我是 XCode 的新手,所以我不确定该怎么做。我检查了 Info.plist 并将我自己的内部版本号设置为 3。

我只是不知道什么是有效的构建版本以及在哪里可以找到它。我见过类似的问题,其中缺少构建版本号,但没有任何内容可以谈论构建版本无效。

设置 $(CURRENT_PROJECT_VERSION) 作为 CFBundleVersion 的值是解决这个问题的方法。

如果您的项目中有两个名为 Resources 的文件夹,也会发生这种情况。这发生在我身上。将其中一个 Resources 文件夹重命名为其他名称,解决了这个问题。