An application bundle was not found at the provided path. Provide a valid path to the desired application bundle.

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.

There was a release note about this, but it may not have been obvious.

Running a WatchApp that requires the companion iOS app to be installed will result in an error if the run destination is set to a Watch via iPhone Simulator pair. (119640671) Workaround: Select a singular Watch Simulator run destination and then Run.

Thank you for the workaround! I can confirm that this does work for us. How would you recommend testing features that require both apps? Maybe build and run to the iPhone simulator, then connect to the apple watch by selecting the right watchOS simulator and selecting Product > Perform Action > Run Without Building?

Yes, you can run the iOS app once to get it in stalled on the phone Sim and then switch to the watch scheme and select just a watch Sim and then either a. build and run again or b. Run without building. You could also drag and drop the iOS app from the build products into a running iOS Simulator window.

Sorry for the rigamarole!

It appears to have been fixed in Xcode 15.3 that has been released on March 5th.

From the 15.3 release notes:

Devices

Resolved Issues

Fixed: Running a WatchOS app that requires the companion iOS app to be installed will result in the error “An application bundle was not found at the provided path” when the run destination is set to a Watch via iPhone Simulator pair. (119640671)

An application bundle was not found at the provided path. Provide a valid path to the desired application bundle.
 
 
Q