I am facing this error while trying to run WatchOS app on simulator.
An application bundle was not found at the provided path. Provide a valid path to the desired application bundle.
Error Detail is as followed
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
The build succeeds but the path at which build is saved and the path from which Xcode tries to run on Watch simulator are different.
Actual build path: file:///Users/abdullahshahid_1/Library/Developer/Xcode/DerivedData/SIMOSA-hdnvefmzxxdlwqagsrxeojmlbnje/Build/Products/Debug-watchsimulator/Jazz%20World%20Watch%20App.app
Xcode is looking at path: file:///Users/abdullahshahid_1/Library/Developer/Xcode/DerivedData/SIMOSA-hdnvefmzxxdlwqagsrxeojmlbnje/Build/Products/Debug-watchos/Jazz%20World%20Watch%20App.app
Difference: Build is saved in Debug-watchsimulator
folder but Xcode tries to install from Debug-watchos
I think Xcode uses path from TARGET_TEMP_DIR
but I don’t know how to make it correct.
Do anyone know how to fix this?
I tried to clean build folder, clear derived data folder, restart Macbook and restart xcode. But couldn’t succeed.
The solutions I found on stack overflow are for React Native but nothing specifically for native iOS.
2
Answers
This appears to be a bug in Xcode 15.1 (and it’s still unresolved in Xcode 15.2). Quote from the Xcode 15.2 Release Notes:
Another workaround is to use an older version of Xcode (like 15.0.1).
Another workaround is to create a symbolic link on the following folder:
/Xcode/DerivedData/<YOUR_APP>/Build/Products/
enter to that path in the TerminalAnd run:
ln -s Debug-watchsimulator Debug-watchos
You’ll need to do the same if you Clean the build folder or Rebuild the app.
Reference: https://forums.developer.apple.com/forums/thread/743221#775164022