我在尝试在模拟器上运行 WatchOS 应用程序时遇到此错误。
An application bundle was not found at the provided path. Provide a valid path to the desired application bundle.
错误详情如下
Simulator device returned an error for the requested operation.
Domain: NSPOSIXErrorDomain
Code: 2
Failure Reason: An application bundle was not found at the provided path.
Recovery Suggestion: Provide a valid path to the desired application bundle.
User Info: {
DVTErrorCreationDateKey = "2024-01-08 13:24:30 +0000";
IDERunOperationFailingWorker = "_IDEInstalliPhoneSimulatorWorker";
SimCallingSelector = "installApplication:withOptions:error:";
bundleURL = "file:///Users/abdullahshahid_1/Library/Developer/Xcode/DerivedData/SIMOSA-hdnvefmzxxdlwqagsrxeojmlbnje/Build/Products/Debug-watchos/Jazz%20World%20Watch%20App.app";
}
--
Failed to install the requested application
Domain: NSPOSIXErrorDomain
Code: 2
Failure Reason: An application bundle was not found at the provided path.
Recovery Suggestion: Provide a valid path to the desired application bundle.
User Info: {
bundleURL = "file:///Users/abdullahshahid_1/Library/Developer/Xcode/DerivedData/SIMOSA-hdnvefmzxxdlwqagsrxeojmlbnje/Build/Products/Debug-watchos/Jazz%20World%20Watch%20App.app";
}
--
Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
"device_model" = "Watch7,4";
"device_osBuild" = "10.2 (21S364)";
"device_platform" = "com.apple.platform.watchsimulator";
"dvt_coredevice_version" = "355.7.6";
"dvt_mobiledevice_version" = "1643.40.14.100.2";
"launchSession_schemeCommand" = Run;
"launchSession_state" = 1;
"launchSession_targetArch" = "x86_64";
"operation_duration_ms" = 28;
"operation_errorCode" = 2;
"operation_errorDomain" = NSPOSIXErrorDomain;
"operation_errorWorker" = "_IDEInstalliPhoneSimulatorWorker";
"operation_name" = IDERunOperationWorkerGroup;
"param_debugger_attachToExtensions" = 0;
"param_debugger_attachToXPC" = 1;
"param_debugger_type" = 3;
"param_destination_isProxy" = 1;
"param_destination_platform" = "com.apple.platform.watchsimulator";
"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" = 16384;
"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" = "iphonesimulator17.2";
"sdk_osVersion" = "17.2";
"sdk_variant" = iphonesimulator;
}
--
System Information
macOS Version 14.1 (Build 23B74)
Xcode 15.1 (22502) (Build 15C65)
Timestamp: 2024-01-08T18:24:30+05:00
构建成功,但保存构建的路径和 Xcode 尝试在 Watch 模拟器上运行的路径不同。
实际构建路径:
file:///Users/abdullahshahid_1/Library/Developer/Xcode/DerivedData/SIMOSA-hdnvefmzxxdlwqagsrxeojmlbnje/Build/Products/Debug-watchsimulator/Jazz%20World%20Watch%20App.app
Xcode 正在查看路径:
file:///Users/abdullahshahid_1/Library/Developer/Xcode/DerivedData/SIMOSA-hdnvefmzxxdlwqagsrxeojmlbnje/Build/Products/Debug-watchos/Jazz%20World%20Watch%20App.app
差异:构建保存在
Debug-watchsimulator
文件夹中,但 Xcode 尝试从 Debug-watchos
安装
我认为 Xcode 使用来自
TARGET_TEMP_DIR
的路径,但我不知道如何使其正确。
有人知道如何解决这个问题吗?
我尝试清理构建文件夹,清除派生数据文件夹,重新启动 Macbook 并重新启动 xcode。但没能成功。 我在堆栈溢出上找到的解决方案适用于 React Native,但没有专门针对本机 iOS。
这似乎是 Xcode 15.1 中的一个错误(在 Xcode 15.2 中仍未解决)。引自 Xcode 15.2 发行说明:
设备
已知问题
当运行目标设置为 Watch via iPhone Simulator 对时,运行需要安装配套 iOS 应用程序的 WatchApp 将导致错误“在提供的路径中找不到应用程序包”。 (119640671)
解决方法: 选择单个 Watch Simulator 运行目标,然后运行。
另一种解决方法是使用旧版本的 Xcode(如 15.0.1)。