Xcode 9: Could not attach to pid Xcode 9: Could not attach to pid ios ios

Xcode 9: Could not attach to pid


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


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


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.