After update to XCode 15.3 can't run app on My Mac (Designed for iPad) - error: attach by pid 'xxxxx' failed -- attach failed

I can run it on the simulators, and directly on physical devices, but not on My Mac (Designed for iPad). The error is:

error: attach by pid '33190' failed -- attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)

Checked the log and this is what I found:

error 12:44:36.527139-0500 mdbulkimport could not make proxies from uuids in optimized path! Error Domain=NSOSStatusErrorDomain Code=-10814 "Unable to find this application extension record in the Launch Services database." UserInfo={_LSFunction=, _LSLine=679, NSDebugDescription=Unable to find this application extension record in the Launch Services database., SK=, IS=0}

error 12:44:36.527174-0500 mdbulkimport Using expensive fallback path for obtaining plugin proxies from install notifications. This process should be entitled to use the LS database.

default 12:44:36.529748-0500 debugserver [LaunchAttach] (32518) about to task_for_pid(32517)

default 12:44:36.529778-0500 kernel macOSTaskPolicy: (com.apple.debugserver) may not get the task control port of (Piano Motifs) (pid: 32517): (Piano Motifs) is hardened, (Piano Motifs) doesn't have get-task-allow, (com.apple.debugserver) is a declared debugger(com.apple.debugserver) is not a declared read-only debugger

error 12:44:36.529795-0500 debugserver error: [LaunchAttach] MachTask::TaskPortForProcessID task_for_pid(32517) failed: ::task_for_pid ( target_tport = 0x0203, pid = 32517, &task ) => err = 0x00000005 ((os/kern) failure)

So the issue seems to be not finding the application's extension record in the Launch Services database. How is this problem solved?

Answered by AlmightyCz in 787416022

In my case helped to find my app in Applications folder and delete it manually. After that I can start and debug the app even without turning off Debug Executable.

I found this hack solution in Stack Overflow which seems to solve the issue. Edit the Scheme, go to the Info tab and turn off Debug Executable. It would be great to know why this works.

Accepted Answer

In my case helped to find my app in Applications folder and delete it manually. After that I can start and debug the app even without turning off Debug Executable.

I am experiencing the same problem after having installed a production binary of the app. When trying to launch the app from Xcode for debugging with the designed for iPad scheme, there seems to be some confusion between the two. If the app is installed, then that's the one that is launched and attached to the debugger (and thus unusable for debugging as it is not the correct build), if the app is uninstalled manually, then Xcode gives the attach failed error. Turning off Debug Executable in the scheme allows attaching, but it seems the version of the app running is not the one built last by Xcode, but the production version installed (even after I uninstalled it!). Where is this cached and how can I clear it completely?

After update to XCode 15.3 can't run app on My Mac (Designed for iPad) - error: attach by pid 'xxxxx' failed -- attach failed
 
 
Q