升级Xcode 14.3后构建失败



升级Xcode 14.3后,我的flutter运行无法在iOS上运行,但我可以在Android上运行。

我得到以下错误:

Failed to build iOS app
Error output from Xcode build:
↳
2023-04-03 17:29:33.364 xcodebuild[97688:923371] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ id:6EB5FA1B-46DC-4E2D-BA30-9BF413BCB06F }
Available destinations for the "Runner" scheme:
{ platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00006000-001429C12E23801E }
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
Xcode's output:
↳
Writing result bundle at path:
/var/folders/k9/wbd7hvx90_s_1_rt6sqg61b80000gn/T/flutter_tools.3s0yqP/flutter_ios_build_temp_dirw6n3UV/temporary_xcresult_bundle

Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.

改变

<LaunchAction
      buildConfiguration = "Release" to  buildConfiguration = "Debug"

在Runner.xcscheme。

我在构建xcf框架时遇到了同样的问题。原因是在我的情况下,DTVCoreDeviceEnableState(不管那是什么)。

xcodebuild[97688:923371] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)

我的解决方案是在xcodebuild命令行中添加-userdefault参数:

xcodebuild  -project myproject.xcodeproj
-scheme myScheme
-destination 'generic/platform=iOS,name=Any iOS Device'
-configuration Release
-sdk iphoneos
-action build
-derivedDataPath ./DerivedData
-userdefault=DVTEnableCoreDevice=enabled

确保-userdefault参数是命令行中的最后一个参数。否则,该参数将被忽略(至少在我的例子中)。

首先,在xcode中打开项目,

和使用XCODE的导航到

产品比;计划在编辑计划

从发布到调试构建配置

最新更新