The app works fine in the simulator, builds and runs.
When I attach my device (iPhone 3GS running iOS 4.3) and target the iPhone, the result is \"Build failed\" with
Same problem here when building for device. Build failed, but my log all is green checkmarks. Cleaning/deleting build folder doesn't fix it. I read elsewhere that someone solved this problem by deleting and recreating the target, but I haven't completely figured out how to do that yet in XCode 4.
My temporary solution has been to download and install XCode 3.2.6 w/iOS 4.3. I didn't realized that Apple had also released a version of XCode 3 that includes iOS 4.3, allowing you to postpone the upgrade to XCode 4. I filed a bug report with Apple about the Build Failed issue.
udpate from Apple:
When we build this project - albeit on a post-Xcode 4.0 version - we see the following in the ProcessProductPackaging step in the build log:
(null): error: CFBundleIdentifier 'com.yourcompany.Magic_Carpet' contains illegal character '_' invalid bundle identifier 'com.yourcompany.Magic_Carpet'
The ProcessProductPackaging code got an overhaul fairly recently, so we suspect it just wasn't emitting errors properly in Xcode 4.0. Take a look at the transcript of your own build, and if so, then this will likely be fixed in a future release of Xcode (we cannot comment further until a fix has been released).
I switched from an underscore to a dash and it fixed the problem.