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:
What would be permanent solution of this issue, as it's disturbing frequently?
(most likely solution) 1. Simulator-> Hardware-> Erase all contents and Settings
(less likely solution) 2. keychain-> upper right lock-> unlock and lock again (or the other way around)
Still not a permanent solution, but I had to quit and restart XCode as the other solutions did not work for me.
delete derived data and clean the project, wait until processing is complete, this may take some time. The idea is to give some processing time. Works fine after that
I hate to add more noise to this, but for me, the answer is to, nonsensically, usesudo
.Run normally, Xcode 9.4.1 (9F2000) and Xcode 10.0 beta 4 (10L213o) both failed to attach to my app after multiple tries, giving the error quoted in the original post.
What worked was to run Xcode (9.4) with sudo,
I don't see why
sudo
is necessary. The Cocoa app to which I am attaching is a Debug build that I just built in Xcode 9.4.1 and dragged into/Applications
. It is not codesigned. Posix permissions on the.app
, itsContents
, itsMacOS
, and the executable are all octal 755. Owner is me. It works fine if I leave it in the Build folder, build and debug in the normal way.The problem is apparently with lldb. I also tried using lldb (lldb-902.0.79.7) from the command line. I got the same result. It works only with
sudo
. Withoutsudo
,Killing my simulator and then running it again from Xcode.
This seems to be a temporary issue when you are trying to build too fast after a build has started. Try stopping and running the project again.