Recently after our yearly provisioning profile updates we do for a client I wanted to run a quick debug version on a iDevice to make sure everything was still functioning. I connected the device and pushed the App to the device via Xcode. The device started up the App but Xcode returned:
Failed to get the task for process
The App continued to run on the device I just couldn’t hit any breakpoints as I used the App on the device. A quick search turned up something interesting, it seems in my haste I had assigned my newly renewed Ad-Hoc profile to my debug build settings. After changing the debug profile to use my Development certificate everything was working fine again.
Source: Stack Overflow