You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xcode 15.3真机部署报CoreDeviceError 3002/3000,IPA打包失败求助

环境信息

  • macOS Version 14.4.1(Build 23E224)
  • Xcode 15.3(22618)(Build 15E204a)

问题描述

项目在模拟器上运行正常,但部署到iPhone真机时,编译成功但安装失败,报错信息如下:

Failed to install the app on the device.
Domain: com.apple.dt.CoreDeviceError
Code: 3002
User Info: {
    DVTErrorCreationDateKey = "2024-04-12 13:00:55 +0000";
    IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker;
    NSURL = "file:///Users/Username/Library/Developer/Xcode/DerivedData/project-dwlcjztonmnjygafwwnxdjtbzkwe/Build/Products/Debug-iphoneos/target.app/";
}
--
Failed to install the app on the device.
Domain: com.apple.dt.CoreDeviceError
Code: 3002
User Info: {
    IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker;
    NSURL = "file:///Users/Username/Library/Developer/Xcode/DerivedData/project-dwlcjztonmnjygafwwnxdjtbzkwe/Build/Products/Debug-iphoneos/target.app/";
}
--
The item at target.app is not a valid bundle.
Domain: com.apple.dt.CoreDeviceError
Code: 3000
Failure Reason: The path to the provided bundle's main executable could not be determined.
Recovery Suggestion: Ensure that your bundle's Info.plist contains a value for the key CFBundleExecutable.
User Info: {
    NSURL = "file:///Users/Username/Library/Developer/Xcode/DerivedData/project-dwlcjztonmnjygafwwnxdjtbzkwe/Build/Products/Debug-iphoneos/target.app/";
    ProvidedBundle = "file:///Users/Username/Library/Developer/Xcode/DerivedData/project-dwlcjztonmnjygafwwnxdjtbzkwe/Build/Products/Debug-iphoneos/target.app/";
}
--

Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_isCoreDevice" = 1;
    "device_model" = "iPhone12,1";
    "device_osBuild" = "17.4.1 (21E236)";
    "device_platform" = "com.apple.platform.iphoneos";
    "dvt_coredevice_version" = "355.24";
    "dvt_mobiledevice_version" = "1643.100.58";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 2486;
    "operation_errorCode" = 3000;
    "operation_errorDomain" = "com.apple.dt.CoreDeviceError.3002.com.apple.dt.CoreDeviceError";
    "operation_errorWorker" = IDEInstallCoreDeviceWorker;
    "operation_name" = IDERunOperationWorkerGroup;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 3;
    "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" = 99;
    "param_launcher_substyle" = 8192;
    "param_runnable_appExtensionHostRunMode" = 0;
    "param_runnable_productType" = "com.apple.product-type.application";
    "param_structuredConsoleMode" = 1;
    "par[tag:am_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphoneos17.4";
    "sdk_osVersion" = "17.4";
    "sdk_variant" = iphoneos;
}

同时生成.ipa文件时也出现错误。

已尝试的解决方案

  • 清理项目后重新部署至真机;
  • 断开iPhone与Mac连接,在iPhone上清除信任电脑、卸载应用后重新配对设备;
  • 在项目Target的Build Settings中为Excluded Architectures添加arm64;
  • 将归档目录改为本地SSD;
  • 关闭并重新开启Mac的开发者模式后重新部署。

以上方法均未解决问题,恳请提供有效解决方案。


解决方案

1. 修复Info.plist的CFBundleExecutable配置

打开项目主Target的Info.plist文件:

  • 若不存在CFBundleExecutable键,添加该键,类型选String,值设为$(EXECUTABLE_NAME);
  • 若已存在,确认值为$(EXECUTABLE_NAME),避免手动输入错误文件名。

2. 验证Build Settings的可执行文件配置

进入项目Target的Build Settings,搜索并确认:

  • Product Name与项目主目标名称一致;
  • Executable Prefix/Executable Suffix无错误配置,避免生成的可执行文件名与Info.plist不匹配;
  • Mach-O Type设置为Executable(主应用Target的正确类型)。

3. 重置Xcode缓存与派生数据

  • 关闭Xcode;
  • 删除~/Library/Caches/com.apple.dt.Xcode目录下所有内容;
  • 执行Cmd+Shift+K清理项目构建文件夹;
  • 重新打开项目并尝试部署。

4. 检查派生数据目录权限

前往~/Library/Developer/Xcode/DerivedData/,找到当前项目对应的文件夹:

  • 右键选择「显示简介」,确认当前用户拥有读写权限;
  • 权限异常时,解锁后添加当前用户并赋予读写权限。

5. 排查签名与描述文件

  • 进入Target的Signing & Capabilities,确认证书和描述文件有效;
  • 尝试重新下载描述文件,或在Apple Developer后台重新生成证书后导入Xcode。

6. 清理重复的Info.plist文件

搜索项目中所有Info.plist,确保只有主应用Target的Info.plist被正确配置,避免子模块/第三方库的Info.plist覆盖主配置。


内容的提问来源于stack exchange,提问作者Prem Verma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 23:44:54