Duplicated Xcode 4.4.1 Target Fails to Run

When I duplicated a working target today, I noticed Xcode would give me the following error when trying to run it in the simulator or device:

Xcode cannot run using the selected device

Xcode cannot run using the selected device.

Choose a destination with a supported architecture in order to run on this device.

The target builds fine and I’ve made no changes since duplicating it. I made sure all the build settings are the same, including architectures and SDKs. I was baffled on what might be causing the error.

After searching a bit, I found this post on StackOverflow: Xcode 4.4 – Unable to run project. The answer is hidden in the response by Martin Lockett. The default product name Xcode gives to a duplicated target is “AppName copy”. Spaces are illegal in product names, so it was failing to run on any device because of that.

After fixing the product name by removing the space, I was able run on both the simulator and device.

I’m not sure if previous Xcode had this problem, why Xcode duplicates a project with a product name that makes it unrunnable, nor why Xcode doesn’t provide a better error message, but I’m glad I figured what was going on.