When i try to launch my application from Xcode to the device, i get this error:
error: failed to launch \'/Users/Luca/Library/Developer/Xcode/DerivedData/myapp-b
Sometimes it helps disconnecting the device and plug it again
I also ran into this problem compiling a Cocos2D project on an iPhone 4. That was after having followed all the steps suggested by Jeff Grimes but to no avail. Everything had been working fine, so I was a bit stumped.
The fail was a caused by change of the UIRequiredDeviceCapabilities
for accelerometer
from YES
to NO
(as the app isn't using accelerometer I decided to just drop the requirement). I changed it back and everything is fine - compiling again.
Incidentally - I thought that changing the value of the key to NO
meant that the accelerometer would just not be required. This is wrong - this breaks the compiler as it checks to make sure the device has NOT got an accelerometer, which of course returns true for most devices. So you just need to delete that row entirely if you don't need accelerometer support.
I have the same problem. In my case, I just upgraded the iPhone from iOS 6.1 to iOS 7.0.4. I can install the app from Xcode 5 onto the device but it could not be launched. I did a lot the above suggestion in disconnecting, removing app, remove folder and restart Xcode. It still could not work, until I reboot the iPhone. After restarting iPhone, I repeat the above and now it works.
I just wanted to add one more tip to prevent this from happening:
DO NOT detach your physical device before you hit the stop debugging button from xCode. This is actually the most common case after which I met the "could not launch" issue. In my case, 80% of the issue is caused by this... just accidentally detached the device during debugging...
Keep in mind. :P