failed to get the task for process when the app was signed with a distribution or ad-hoc provisioning profile, which sets get-task-allow to false and blocks the debugger. Switch the Debug configuration’s Code Signing Identity to Apple Development (iPhone Developer) and select a development provisioning profile, then delete the old build from the device and run again.Why this happens
The full message usually reads Failed to get the task for process 1234 (sometimes with the app name instead of a PID). Xcode installed and launched your app on the device, but lldb could not attach to the running process.
Attaching requires the app’s signature to carry the get-task-allow entitlement set to true. Development provisioning profiles set it to true. Ad-hoc and App Store distribution profiles set it to false — that is the whole point of them. So when the Debug configuration is accidentally pointed at a distribution identity or an ad-hoc profile, the app launches fine and the debugger is locked out.
The second most common cause is that the binary running on the device is not the one Xcode just built. An older ad-hoc or TestFlight build with the same bundle identifier is still installed, or the install silently failed, and Xcode attaches to a process it has no rights to debug.
The third is inconsistent signing across targets: an embedded framework, an app extension, or a prebuilt third-party SDK signed with a different identity, or missing the architecture slice the device needs.
How to fix it
1. Sign the Debug configuration with a development identity
This is the fix in the overwhelming majority of cases. Open the target’s Signing & Capabilities tab (or Build Settings > Code Signing Identity on older projects) and check the Debug column specifically:
- Code Signing Identity — Debug:
Apple Development(older Xcode:iPhone Developer). Release:Apple Distribution(iPhone Distribution). - Provisioning Profile — Debug: a development profile, never an ad-hoc one.
Check both the project level and the target level. A target-level value of $(inherited) picks up whatever the project sets, and that is where a stray distribution profile tends to hide.
If you use automatic signing, make sure the Debug configuration is not overridden by a manual profile in Build Settings — manual settings win over the checkbox.
2. Confirm the scheme runs Debug
Product > Scheme > Edit Scheme > Run. The Build Configuration must be Debug, and Debug executable must be checked on the Info tab. A scheme set to Release will build a distribution-signed app and reproduce the error every time.
3. Remove the stale build from the device
If the wrong build is already installed, fixing signing alone will not help until it is replaced.
- Delete the app from the device’s Home Screen.
- In Xcode: Product > Clean Build Folder (Shift-Cmd-K).
- Delete Derived Data (Xcode > Settings > Locations > Derived Data, then the arrow to reveal it in Finder).
- Run again.
4. Verify what was actually signed
You can read the entitlements straight out of the built product:
codesign -d --entitlements :- /path/to/DerivedData/Build/Products/Debug-iphoneos/MyApp.app
Look for this in the output:
<key>get-task-allow</key>
<true/>
If it says <false/>, the build is distribution-signed and no amount of restarting Xcode will fix it. To see which identity was used:
codesign -dv --verbose=4 MyApp.app
The Authority= and TeamIdentifier= lines tell you exactly which certificate signed the bundle.
5. Check every embedded binary
Frameworks, app extensions, watch apps and widgets each carry their own signature. A prebuilt third-party SDK signed for distribution, or built for a single architecture, will break the launch even when the main app is correct.
codesign -dv --verbose=4 MyApp.app/Frameworks/SomeSDK.framework
lipo -info MyApp.app/Frameworks/SomeSDK.framework/SomeSDK
In the target’s General tab, Frameworks, Libraries, and Embedded Content, embedded frameworks should be set to Embed & Sign so Xcode re-signs them with your team’s identity at build time. If a vendor ships a framework that must keep its own signature, ask for a build that includes the architectures you target.
6. Clear out stale certificates and profiles
If signing identities look correct but the build still fails to attach, the local keychain may hold an expired or duplicated certificate:
security find-identity -v -p codesigning
Remove expired or duplicate entries in Keychain Access, then in Xcode > Settings > Accounts select your team and click Download Manual Profiles. Re-select the profile in Build Settings afterwards — Xcode does not always re-resolve a profile that was deleted and re-added.
7. Know when this is expected behaviour
You cannot debug an App Store, TestFlight or ad-hoc build. Those are distribution-signed by design and get-task-allow is false. If you are trying to attach the debugger to a build you downloaded rather than built, that is not a bug — install a development-signed build from Xcode instead.
How to prevent it
- Keep Debug pinned to a development identity and Release to a distribution identity, and never copy Release settings down into Debug to “make it build”.
- Prefer automatic signing for Debug so the profile is regenerated when certificates change.
- Do not install an ad-hoc or TestFlight build over an Xcode build with the same bundle identifier on the same device — delete the app first, or give the debug build a separate bundle ID.
- When a debug session refuses to attach, check
get-task-allowbefore touching anything else; it answers the question in one command. - Prune expired certificates and stale provisioning profiles after any team or device change.
FAQ
Why does this only happen on a real device and not the simulator?
Simulator apps are not signed with a provisioning profile, so get-task-allow never comes into play. The error is specific to device installs where the signature is checked.
Is my provisioning profile broken?
Usually not. A distribution profile is behaving exactly as designed by refusing a debugger attachment. The problem is that the wrong profile type was selected for the Debug configuration.
Can I debug a TestFlight or ad-hoc build?
No. Those builds are signed for distribution with get-task-allow set to false. To debug, archive is not the path — build and run a development-signed copy from Xcode onto the same device.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.