watchOS真机运行报错:CoreDevice无法创建书签数据
watchOS真机运行报错:CoreDevice无法创建书签数据(模拟器正常)
问题现象
运行watchOS应用时仅真机触发报错,模拟器无异常。已尝试重启设备、清除缓存、删除构建文件夹,问题仍未解决。
报错详情
Could not obtain access to one or more requested file system resources because CoreDevice was unable to create bookmark data. Domain: com.apple.dt.CoreDeviceError Code: 1005 User Info: { DVTErrorCreationDateKey = "2023-11-02 07:41:25 +0000"; IDERunOperationFailingWorker = IDECoreDeviceSideInstallAppWorker; NSURL = "file:///Users/abid/Library/Developer/Xcode/DerivedData/Halcyon-coojvzkgmktyzsainzuhkwpehwct/Build/Products/Debug/Halcyon.app"; } -- The file couldn’t be opened because it doesn’t exist. Domain: NSCocoaErrorDomain Code: 260 Failure Reason: The file doesn’t exist. -- Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_isCoreDevice" = 1; "device_model" = "Watch5,9"; "device_osBuild" = "10.2 (21S5331f)"; "device_platform" = "com.apple.platform.watchos"; "dvt_coredevice_version" = "355.7"; "dvt_mobiledevice_version" = "1643.40.14"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = "arm64_32"; "operation_duration_ms" = 1; "operation_errorCode" = 260; "operation_errorDomain" = "com.apple.dt.CoreDeviceError.1005.NSCocoaErrorDomain"; "operation_errorWorker" = IDECoreDeviceSideInstallAppWorker; "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.watchos"; "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" = 0; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "watchos10.2"; "sdk_osVersion" = "10.2"; "sdk_variant" = watchos; } --
系统信息
- macOS Version 14.2 (Build 23C5030f)
- Xcode 15.1 (22501) (Build 15C5042i)
- 时间戳: 2023-11-02T13:11:25+05:30
解决方案建议
1. 验证构建产物路径
根据报错提示,Xcode找不到指定路径下的Halcyon.app,手动前往路径/Users/abid/Library/Developer/Xcode/DerivedData/Halcyon-coojvzkgmktyzsainzuhkwpehwct/Build/Products/Debug/确认文件状态:
- 文件不存在:执行Clean Build Folder(快捷键
Cmd+Shift+Option+K)后重新构建 - 文件存在:右键点击
.app文件,选择Show Package Contents确认内部结构完整
2. 重置Xcode与CoreDevice关联
- 关闭Xcode,打开活动监视器,搜索并结束所有
coredevice相关进程 - 终端执行命令重置CoreDevice缓存:
rm -rf ~/Library/Developer/CoreDevice - 重新打开Xcode,连接真机后重新运行
3. 检查真机配对与权限
- 断开并重新配对Apple Watch与iPhone,确保配对过程中授权Xcode访问设备
- 在iPhone的设置 > 通用 > VPN与设备管理中确认Xcode开发者权限已信任
- 检查Apple Watch系统版本,确保与Xcode使用的watchOS SDK(10.2)匹配
4. 调整Xcode构建配置
- 打开项目Build Settings,搜索
Build Products Path,确认路径未被修改为无效位置 - 检查
Architectures设置,确保arm64_32架构的构建配置正确
5. 调整Xcode版本
当前使用的是Xcode 15.1测试版,可能存在CoreDevice相关已知bug:
- 切换到Xcode 15正式版
- 或升级到最新Xcode测试版,查看问题是否已修复
内容的提问来源于stack exchange,提问作者Mohammed Abid Nafi
相关产品推荐
相关产品推荐

