Xcode 9 - Could not attach to pid for Frameworks u

2019-03-11 03:32发布

I am getting the following error after migrating from one mac to another using time machine.

Could not attach to pid

Ensure "project title" is not already running, and "system username" has permission to debug it.

The error occurs only when running the unit tests for (any) Framework project. Running an application on simulator and device works fine.

Running unit tests for an application works, but running it for any framework can't be launched due to this error. I am getting this error even with Alamofire or PromiseKit unit tests.

I tested the solutions suggested on similar questions on Stackoverflow (I deleted derived data, cleaned everything, reinstalled Xcode, restarted the mac ..) nothing solved the issue till now.

I am using Xcode 9.3 and tested this with Xcode 9.4-beta also.

I am running on Mac OS High Sierra - 10.13.4 (17E199)

Any help / suggestion is welcome!

6条回答
ら.Afraid
2楼-- · 2019-03-11 03:48

After opening a bug report to Apple, they suggested me to:

  • Check if my user is an Admin user. It was the case.
  • Check if I have "_developer" group, in the output of groups command. it was the case. Use this command: dscacheutil -q group
  • Check developer mode rights using the command sudo /usr/sbin/DevToolsSecurity -status. The status was unknown for me.
  • Enable developer mode rights if needed, using the command sudo /usr/sbin/DevToolsSecurity -enable. This solved finally my issue!
查看更多
【Aperson】
3楼-- · 2019-03-11 03:56

Haven't seen this exact error, but I've found removing the derived data helps fix some transient errors that pop up after updates etc.

You can find the location of your derived data folder in Xcode.
Open preferences/locations and click the arrow.
Once in derived data you can remove all the folders. FYI after deleting the derived data folder all your projects will need to be rebuilt.

Hope this helps!

Xcode preferences/locations

查看更多
We Are One
4楼-- · 2019-03-11 03:58

You can do this following steps -

  1. Kill your simulator and then run it again from Xcode.

  2. If you are trying to build too fast after a build has started. Try stopping and running the project again.

  3. This can be a issue with the untrusted certificates in key-chain access, please remove such a type of certificates and re-build again.

Finally, you can do is recheck the Keychain certificates. Delete the exiting ones by right clicking (they'd passed expiration) and unchecked "automatically manage signing" in Targets->General

Hope above steps will solve your problem.

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-03-11 04:01

I was able to resolve this issue by:

  1. adding Single View App target (I named it HostApp)
  2. setting HostApp target as a host application for test target

Setting HostApp as a host application

查看更多
手持菜刀,她持情操
6楼-- · 2019-03-11 04:07

You can try some following steps -

  1. Open the keyChain and check the Keychain certificates and delete the existing ones which are expired.
    1. Uncheck the - automatically manage sign in from Xcode project settings.
    2. Delete any derived data
    3. Clean the project by cmd+k
    4. Then Close and Restart the project and Run...

I hope it will work.

查看更多
Melony?
7楼-- · 2019-03-11 04:11

If you have Mojave OS then:

1) Open your target scheme

enter image description here

2) Uncheck this one

enter image description here

3) Select this scheme while testing this target (ex. Testing "TestApiTarget" - select "TestApiTarget" in schemes on tests).

Its temporary solution from bug report

查看更多
登录 后发表回答