Xcode 9: Could not attach to pid

2019-03-09 06:47发布

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?

13条回答
Rolldiameter
2楼-- · 2019-03-09 07:03

(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)

查看更多
姐就是有狂的资本
3楼-- · 2019-03-09 07:07

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

查看更多
淡お忘
4楼-- · 2019-03-09 07:08

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

查看更多
Deceive 欺骗
5楼-- · 2019-03-09 07:17

I hate to add more noise to this, but for me, the answer is to, nonsensically, use sudo.

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,

sudo /Applications/Xcode.app/Contents/MacOS/Xcode

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, its Contents, its MacOS, 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. Without sudo,

error: attach failed: unable to attach
查看更多
一纸荒年 Trace。
6楼-- · 2019-03-09 07:18

Killing my simulator and then running it again from Xcode.

查看更多
爱情/是我丢掉的垃圾
7楼-- · 2019-03-09 07:19

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.

查看更多
登录 后发表回答