Application launch did not return a valid pid nor a launch error

Viewed 8577

My app installs fine on the simulator and I can attach the process after opening it manually but it won't run from the debug play button without throwing the error below.

I've tried all the tricks I know (deleting the derived data and re-compiling, commenting out some code here and there, exhaustive searches for keywords).

Any help or insight would be greatly appreciated.

Details

Application launch for '------' did not return a valid pid nor a launch error.
Domain: NSPOSIXErrorDomain
Code: 3
Failure Reason: No such process
User Info: {
    IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher;
}
--

Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_model" = "iPhone14,2";
    "device_osBuild" = "15.0 (19A339)";
    "device_platform" = "com.apple.platform.iphonesimulator";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = "x86_64";
    "operation_duration_ms" = 845;
    "operation_errorCode" = 3;
    "operation_errorDomain" = NSPOSIXErrorDomain;
    "operation_errorWorker" = IDELaunchiPhoneSimulatorLauncher;
    "operation_name" = IDERunOperationWorkerGroup;
    "param_consoleMode" = 0;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 3;
    "param_destination_isProxy" = 0;
    "param_destination_platform" = "com.apple.platform.iphonesimulator";
    "param_diag_MainThreadChecker_stopOnIssue" = 0;
    "param_diag_MallocStackLogging_enableDuringAttach" = 0;
    "param_diag_MallocStackLogging_enableForXPC" = 1;
    "param_diag_allowLocationSimulation" = 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" = 0;
    "param_runnable_appExtensionHostRunMode" = 0;
    "param_runnable_productType" = "com.apple.product-type.application";
    "param_runnable_swiftVersion" = "5.5.1";
    "param_runnable_type" = 2;
    "param_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphonesimulator15.0";
    "sdk_osVersion" = "15.0";
    "sdk_variant" = iphonesimulator;
}
--


System Information

macOS Version 11.6.1 (Build 20G224)
Xcode 13.1 (19466) (Build 13A1030d)
Timestamp: 2021-11-18T16:14:15-07:00
8 Answers

Faced the same problem. The problem was that the simulator was launched before Xcode.

Solution: Just close the simulator and build the project again

Ok turns out this mystery no-name Environment Variable was checked in the scheme. I unchecked it and it worked.

enter image description here

For me the solution was to change the Mach-O Type to bundle, then run the app again (same error) and change it back to Executable again.

Your Target > Build Settings

I tried changing the Mach-O type (which was not set) but it did not help.
Restarting the simulator solved it (it was open before the Xcode was opened).

I experienced a similar issue and solved it by running $ flutter clean && flutter run. The Xcode workspace just needed clearing.

In my case, I was trying to run unit test and similar error shows up after lunching app on the simulator.

What worked for me is that I didn't notice the compiler error while building the unit test target. After fixing the test target build issue, app runs fine again. So, make sure the project is building without any error.

If your error started suddenly, just think of the action you performed earlier that might have caused this. I had added libc++.tbd library in incorrect xcode/simulator location. Removing that fixed my issue

There seem to be multiple causes of this error. I'm running on an M1 Max / macOS Monterey. I tried some of the above solutions but found that they were either not applicable or had no effect. In the end, the answer (for my config) was here -- install Rosetta. This was also what Xcode had been prompting me to do at every launch. I am running an app that uses Cocapods.

Related