When I try to execute my iPhone application in simulator, I get the dreaded error
For what it's worth, after reading this thread, I decided to just delete my targets and recreate them. Problem went away.
EDIT: After thinking I had finally found a way of working through this, I discovered I still had issues.
The only surefire way I discovered to fix this issue is to create a new project from scratch. Then when adding new targets, rather than adding a new target, duplicate the existing target.
One thing I have noticed is that if the Project and the Targets have the GCC 4.2 settings on their settings page than everything seems to work fine. If, however, those settings are missing and instead is a section called 'User-Defined' than all sorts of weird errors occur.
I have no idea whether those settings are a symptom or the source of the problem. I have also discovered no way to consistently get the settings page to switch.
One solution, that I have seen work sometimes (but, also seen not work many other times) is to switch the active target to Device while a device is plugged in. In certain cases this causes the correct settings to load. Then when you switch back to Simulator the correct settings are still there and everything seems to work fine.
I believe I have also noticed the following: My original project file had the GCC settings on the Project Settings page. One of the targets had the settings and worked, the other target didn't and didn't work. I deleted all of the targets and re-added two new targets. After this the GCC settings disappeared on the project settings page and were also absent from the settings pages of any targets that I created. Nothing I did could change that. Any of the targets I tried to install in the simulator result in the simulator showing a black screen with an error message simply saying failed to run in the simulator with an unknown error.
Attempting to run those same targets on the device failed instantly without ever even attempting to compile (even after cleaning all targets) with an error saying something about invalid file.
I'd really love to know what's going on, but after 6 hours of no progress, I gave up and simply recreated the project and the targets as described above and everything works fine.
I had the same issue. I had a lite scheme and a full version scheme. Neither radio button was selected under Launch. I wish I had taken a screenshot when it was in this state. As soon as I clicked "Automatically" it worked just fine.
Seems like a pretty glaring issue with XCode 4.
I had a similar issue. I was also unable to install the app on a device, getting a 'The application bundle does not contain a valid identifier." error message. This was due to a directory named "Contents" added as a Folder Reference. I removed the reference, renamed the directory, add it again as a Folder Reference, clean the project, rebuild and voilà, I was able to launch the simulator.