Xcode will transfer the app to the iPhone, and I can run it on the iPhone, but the Xcode debugger fails to attach. I am using iPhone 14 Pro with iOS 18.6.
I've tried connecting via cable, also via network - same issue both ways.
The message raised by Xcode says:
Could not attach to pid: "6303"
Ensure “<a\AppName>” is not already running, and <MyName> has permission to debug it.
I don't know how to determine if I have permission. I assume I do; I am the owner of the account, with admin role.
I built a very basic test app from Xcode templates
That’s always a great diagnostic test. In this case it confirms that there’s something specific about your main project that’s causing this issue. I have some further suggestions:
- From the Home screen, remove your main app from the device.
- And then restart the device. These steps should remove any state leftover from any previous builds of the app.
- Do a clean build of the app.
- Do a Product > Run. Does it still reproduce the problem?
- Presuming it does, run the app from the Home screen and then do a Debug > Attach to Process. Does that work?
Also, after the rebuild in step 3, choose Product > Show Build Folder in Finder, then navigate to the Debug-iphoneos
folder and, in Terminal, run this command:
% codesign -d --entitlements - MyApp.app
…
[Dict]
…
[Key] get-task-allow
[Value]
[Bool] true
As this code is Development signed, you should see the get-task-allow
entitlement. This is what allows the debugger to attach.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"