I used to get this message when building for my device.
“Could not launch xyz failed to get the task for process xyz”
The message seems to be harmless, as I can dismiss the warning dialog. The app on my device launches for a second and then exits.
The app can be launched normally afterwards.
I finally realised that what I did wrong was that I used a distribution provision for signing the app.
Once I made the switch to a development provisioning profile, the app can be installed and can even be hooked to the XCode debugger.