Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 9: Could not attach to pid

Tags:

xcode

ios

xcode9

I've been facing an issue (frequently) with the recent major release of the iOS application development tool - Xcode 9-beta.

It's showing me the following error frequently while running/debugging app in Simulator (iOS 11).

Could not attach to pid : “2370”
Ensure <project title> is not already running, and <system username> has permission to debug it.

Here is a snapshot for the same issue:

error message - Could not attach to pid

What would be permanent solution of this issue, as it's disturbing frequently?

like image 661
Krunal Avatar asked Jun 20 '17 10:06

Krunal


4 Answers

If issue is on OS Mojave and you are trying, like me to run tests on older Xcode version (lower than 10.0), make sure that in your scheme, when you select Test, Debug executable is disabled

enter image description here

You won't be able to debug tests from this point

like image 147
ninja_iOS Avatar answered Nov 16 '22 12:11

ninja_iOS


Still not a permanent solution, but I had to quit and restart Xcode as the other solutions did not work for me.

like image 25
PicklesIIDX Avatar answered Nov 16 '22 14:11

PicklesIIDX


This worked for me:

Edit Scheme -> Info -> Executable -> Ask on launch

Credits to @nastya-gorban's answer here

Update

After spending a considerable time with examples on Apple bug report, they basically disregarded the issue as using manual certificates is not "expected".

Long story short, if you don't have a business account and hence multiple developers on the same account, you should be fine with using the automatic signing and should not see the issue.

If you do have a business account with multiple users (which I found it breaks automatic signing), this is their suggestion:

We suggest that you use automatic signing for your debug builds and manual signing for your distribution builds.

like image 15
Efren Avatar answered Nov 16 '22 12:11

Efren


Killing my simulator and then running it again from Xcode.

like image 11
user2421755 Avatar answered Nov 16 '22 13:11

user2421755