升级Xcode14.3与iOS16.4后Flutter项目无法安装Runner求助
问题描述
将Xcode升级至14.3、iPhone系统升级至iOS16.4后,Flutter项目无法在iOS16.4设备上安装Runner,但在iOS14设备上可正常工作。报错详情如下:
Unable to install "Runner" Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653179 User Info: { DVTErrorCreationDateKey = "2023-04-03 09:24:05 +0000"; IDERunOperationFailingWorker = IDEInstalliPhoneLauncher; } Could not write to the device. Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653179 User Info: { DVTRadarComponentKey = 261622; MobileDeviceErrorCode = "(0xE8000005)"; "com.apple.dtdevicekit.stacktrace" = ( 0 DTDeviceKitBase 0x000000010c8a4b1c DTDKCreateNSErrorFromAMDErrorCode + 300 1 DTDeviceKitBase 0x000000010c8d9000 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 136 2 DVTFoundation 0x0000000103927ac8 DVTInvokeWithStrongOwnership + 76 3 DTDeviceKitBase 0x000000010c8d8d7c -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1208 4 IDEiOSSupportCore 0x000000010cea7ce8 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.147 + 2340 5 DVTFoundation 0x0000000103a32428 __DVT_CALLING_CLIENT_BLOCK__ + 16 6 DVTFoundation 0x0000000103a32e94 __DVTDispatchAsync_block_invoke + 152 7 libdispatch.dylib 0x00000001ace6a874 _dispatch_call_block_and_release + 32 8 libdispatch.dylib 0x00000001ace6c400 _dispatch_client_callout + 20 9 libdispatch.dylib 0x00000001ace73a88 _dispatch_lane_serial_drain + 668 10 libdispatch.dylib 0x00000001ace745f8 _dispatch_lane_invoke + 384 11 libdispatch.dylib 0x00000001ace7f244 _dispatch_workloop_worker_thread + 648 12 libsystem_pthread.dylib 0x00000001ad018074 _pthread_wqthread + 288 13 libsystem_pthread.dylib 0x00000001ad016d94 start_wqthread + 8 ); } Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : { "device_model" = "iPhone12,1"; "device_osBuild" = "16.4 (20E247)"; "device_platform" = "com.apple.platform.iphoneos"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 2722; "operation_errorCode" = "-402653179"; "operation_errorDomain" = "com.apple.dt.MobileDeviceErrorDomain"; "operation_errorWorker" = IDEInstalliPhoneLauncher; "operation_name" = IDEiPhoneRunOperationWorkerGroup; "param_consoleMode" = 0; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 5; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphoneos"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 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_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos16.4"; "sdk_osVersion" = "16.4"; "sdk_variant" = iphoneos; } System Information macOS Version 13.3 (Build 22E252) Xcode 14.3 (21812) (Build 14E222b)
解决方案
针对错误码0xE8000005(无法写入设备),按以下步骤逐一排查修复:
清理项目缓存并重建
- 在Flutter项目根目录执行:
flutter clean flutter pub get - 打开Xcode,执行
Product > Clean Build Folder(快捷键Cmd+Shift+K),之后重新编译运行项目。
- 在Flutter项目根目录执行:
验证设备信任与权限
- 确保iPhone通过USB连接Mac时,已在设备端选择“信任此电脑”。
- 进入iPhone
设置 > 通用 > VPN与设备管理,找到你的开发者账号,点击信任对应的应用签名。
升级Flutter至兼容版本
Xcode14.3对Flutter版本有适配要求,执行以下命令升级到最新稳定版:flutter upgrade若稳定版仍存在问题,可尝试切换到beta通道(专门适配Xcode14.3的版本):
flutter channel beta flutter upgrade调整Xcode构建设置
- 打开项目iOS目录下的
Runner.xcworkspace。 - 选中Runner目标,进入
Build Settings:- 将
Build Libraries for Distribution设置为NO。 - 确认
Architectures为Standard Architectures (arm64),移除多余架构配置。
- 将
- 切换到
Signing & Capabilities,检查团队、Bundle ID设置正确,且“自动管理签名”已开启。
- 打开项目iOS目录下的
重置设备连接服务
- 断开iPhone与Mac的USB连接,关闭Xcode。
- 在Mac终端执行:
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService sudo killall -9 usbmuxd - 重启iPhone,重新连接后打开Xcode尝试运行。
检查设备存储空间
设备存储空间不足也会触发该错误,进入iPhone设置 > 通用 > iPhone储存空间,确保有足够空间安装应用。
内容的提问来源于stack exchange,提问作者Noah
相关产品推荐
相关产品推荐

