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.

4 Replies to “Duplicated Xcode 4.4.1 Target Fails to Run”

  1. If Spaces are illegal in the product name field, how come I have 6 other targets in the same project that have 2 words for a product name and a space in-between with no problems??

    Although when I remove the space, it builds! What the heck.. makes no sense.. but it can’t just be the space, cause I have plenty of product names with spaces.. There must be a supplemental reason.

    1. Hmmm, are you confusing Target Name with Product Name? There’s a specific setting called Product Name, and I think that can be different than the name displayed in the UI.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.