55

I was running my app this morning and now all of a sudden I am getting the following error when I try to run on the iPhone 5.1 simulator.

Cannot run on the selected destination

The destination does not support the architecture for which the selected software is built. Switch to a destination that supports that architecture in order to run the selected software.

I deleted the schemes but still no solution.

I am using Mountain Lion. I am using xCode 4.4 (Recently upgraded to Mountain Lion and xCode 4.4)

UPDATE 1: Here is the view of my build settings:

enter image description here

UPDATE: Here is the actual error which prevents from it running.

enter image description here

5
  • Just restarting XCode fixed this for me.
    – Øystein
    Oct 2, 2012 at 17:35
  • I have the same problem. No fix.
    – user4234
    Jan 2, 2013 at 22:28
  • 7
    Remove the Info.plist from the target (not remove the file itself). Or just run Project validate and fix the issues. The problem solved!
    – Bagusflyer
    Feb 19, 2013 at 7:37
  • @bagusflyer: thanks, going to project settings and click "Validate Settings" fix the problem for me, otherwise I have to restart xcode everytime I clean and build again Feb 28, 2013 at 2:43
  • 1
    My issue was that i changed the executable name from ${EXECUTABLE_NAME} in the plist. After changing it back, clearing deriveddata and restarting XCode, i got rid of the error. Apr 12, 2013 at 22:31

37 Answers 37

69

You might follow the steps:

  • Quit Xcode and iPhone simulator
  • Unplug your devices
  • Goto /Users/your_usr_name/Library/Developer/Xcode/DerivedData/
  • Delete all data under this folder
  • Start Xcode again and run your project

Hope this will solve your problem.

4
  • 2
    This worked for me. I didn't need to delete all my projects, just the data relevant to the project that was having problems. Nov 13, 2012 at 9:23
  • clear those folders and Remove the Info.plist from the target (not remove the file itself)
    – zszen
    Apr 22, 2013 at 16:26
  • 3
    @zszen, good point. Usually this problem occurs because of adding -info.plist file to the target. So just select the -info.plist file go to the "File Inspector" (Right panel of the xcode) and uncheck (if it is checked) from target membership. After that follow those steps.
    – x4h1d
    Apr 23, 2013 at 13:00
  • Good tip, but to me worked something little but different. I have two devices with 7.1 but each have different version 11D167 and 11D169. At the folder (/Users/your_usr_name/Library/Developer/Xcode/DerivedData/ was only 7.1 (11D167) but 7.1 (11D169) was missing. When I added copy the data from 7.1 (11D167) to 7.1 (11D169) and restarted the Xcode and reconnect device, the correct data was copied. More at my blog: pjstrnad.com/… Mar 14, 2014 at 12:57
33

I had this issue after updating from Facebook SDK 3.1 to Facebook SDK 3.1.1. My fault, I guess.

Inside "resources" folder, now there is a totally useless but dangerous info.plist that, if imported, may break your project file. Don't know why they included it but I believe few of us made the same mistake recently.

5
  • Same happened to me and removing the Info.plist from the project resolved the issue. Dec 2, 2012 at 10:47
  • 1
    there is info.plist but it's in framework. Yes it happens after updating Facebook SDK. Deleting it is kind of xtreme.
    – user4234
    Jan 2, 2013 at 21:54
  • Yes! Tried everything and worked nothing! Info.plist in Facebook SDK is the reason. Remove reference!
    – Benny7500
    Jan 14, 2013 at 21:20
  • My experiences with this problem, this solution worked well twice.
    – Jinbom Heo
    Jan 30, 2013 at 7:59
  • Yup! just remove the info.plist in the resource folder which is imported from FB SDK. then it will run perfectly again.
    – firestoke
    Jul 23, 2013 at 9:04
17

I found this problem with the version of Xcode 4.4. And finally I solved it this way:

Find the "Info.plist" in your project, then unselect the target membership plus on the right side view of window, it works for me.

6
  • Thank you demon. Those experiencing the same issue may also see: error: failed to attach to process ID 0 You will also see ${PRODUCT_NAME} as your App in the simulator instead of your populated Product Name. I am running XCode 4.5
    – Dean Liu
    Nov 8, 2012 at 20:01
  • what do you mean by target membership? There is no such thing.
    – user4234
    Jan 2, 2013 at 11:26
  • @SharenEayrs it's on the right side view of xcode, u'd choose the right navigation viewer.
    – demon
    Jan 5, 2013 at 4:00
  • I also had a few PSD files that made it into the build cycle. Getting rid of those and the Info.plist file worked for me. Feb 26, 2013 at 17:45
  • I caused this problem by removing and re-adding my info.plist. I followed your suggestion, restarted Xcode, and deleted the derived data folder and fixed it. Thanks!
    – zekel
    Mar 9, 2013 at 15:00
8

You might also want to check if the project uses a supported compiler in the project settingsthe option shown in blue

7

Its just duplicated Info.plist file just use 1 Info.plist file in files then restart xcode its fixed for me

1
  • finally your answer fixed my problem..yup..its because of duplicated info.plist
    – Guru
    May 15, 2013 at 18:47
6

I have just encountered this error in Xcode 4.5.1, and the error went away after I take all non-alpha characters out of the Product Name build setting.

1
  • Thanks a lot! Man I would have searched for this like forever without ever succeeding if it wasn't for your input.
    – Emmanuel
    Sep 20, 2013 at 18:00
4

I believe this may be a current unlisted bug with Xcode 4.4+. I have/had the very same issue with my project. I deleted all versions of Xcode and restarted with 4.4, opened my project and had the error again.

I then started a new project with a template with a different name. Did not have the issue.

I then renamed my old project, started a new empty project with the same name and built/ran and got the error again. This new project was nothing more than a view controller that didn't do anything. I should have gotten a blank screen but got the same error you did.

Frustrated I shut down for the day and re-ran the old project and it worked. I had not changed anything. Currently I have the error again and neither rebooting or restarting Xcode fixes it.

So in summary, a project can have absolutely no changes made, sometimes it builds and runs fine, sometimes you get this error. For the record I did not get this error running Xcode 4.3.

My issue did not show up until I upgraded to Mountain Lion and Xcode 4.4 which happened to be on the same day. Now I can not get back to a 100 percent workable configuration.

4
  • 2
    The latest thing that seems to work for me is to close Xcode. Kill all Xcode processes that seems to linger. Go into /Applications and move all other versions you may have to a different folder outside of Applications. After doing this, Xcode seemed to run the app on the simulator. The one issue I still see is sometimes it will say Running ${EXECUTABLE_NAME} instead of inserting the correct app name. YMMV
    – ptk
    Aug 6, 2012 at 23:32
  • Ok after a week I can safely say its fixed for me. I upgraded to 4.4.1 but what seemed to actually fix it was to move my source tree to a different folder, start another empty template, re-add my source files to the new project and verify that all Build settings had the correct info. I haven't had an issue in a week.
    – ptk
    Aug 14, 2012 at 20:23
  • I think this is a bug too-- Mountain Lion & 4.4. The only thing that solves this for me is to restart my mac, but it soon returns from the dead.
    – Vinnie
    Aug 19, 2012 at 1:44
  • 1
    This is definitely a bug in Xcode 4.4.1. I had the same issue and had to delete and re-install Xcode to get the project to run on my device again. Sep 11, 2012 at 4:10
4

Committing my files to SVN and checking out the project in a new directory fixed this for me.

2
  • after trying everything, seriously only this one worked... shame on apple
    – Gabor
    Oct 30, 2012 at 15:08
  • @SharenEayrs I really hope you're kidding :D Jun 16, 2013 at 10:56
3

Look at both the project and target build settings, at that Architectures, and see if anything has changed. When first going from Xcode 3 to 4, it use to wreck havoc in a hidden way, giving the same error, and in the end you had to add i386 to the "Valid Architectures" line. I just looked at my big project started in Xcode 4.1, and it shows nothing about i386 etc, but I have other newer projects where I get this grayed out thing in that line $(ARCHS_STANDARD_32_BIT).

EDIT: I took a relook at this with a guru friend. Neither of us can find a linkage to i386 in our projects - Xcode is using some magic. That said, I did get a hit to i386 in a binary plist within the project, which leads me to another suggestion.

In your build settings, insure that ALL "Architectures" are $(ARCHS_STANDARD_32_BIT).

If that does not work, we suggest that you look at the compile and ld lines of your build when you select iPhone 5.1 Simulator in the scheme menu - to see if in fact its i386,

Another idea - move all your schemes and user settings to a save folder somewhere (with the project closed), then reopen and recreate a scheme. Now try again. There is no reference to i386 in any of my project.pbxproj files, so our suspicion is that this is somehow related to the scheme setting for the target device.

Good luck!

15
  • I updated the question with the screenshot of my target settings which is same as project settings.
    – azamsharp
    Aug 2, 2012 at 0:28
  • So I assume (hope) that you have Cleaned then rebuild. I have had bizarre Xcode problems that went away on a complete machine restart (YMMV). The build settings is the target not the project right? "iOS Deployment Target" is iOS5.1 too right? If it were me, I'd reboot and hope for the best. Another suggestion - create a new single view iOS project in 4.4 - and run it. does it run? I upgraded to 4.4 as soon as I could, all my stuff still works, but that said still on Lion.
    – David H
    Aug 2, 2012 at 0:41
  • The weird thing is that it all started when I copied my project from my documents directory to desktop. Yes, I have cleaned and rebuild. Earlier on when I restarted it worked but after number of rebuilds I got the same error again.
    – azamsharp
    Aug 2, 2012 at 0:45
  • I updated the original question with the actual error screenshot. It comes when I try to run the app. Also for all the new projects it works fine and everything runs. This project is old which was created in older version of xCode.
    – azamsharp
    Aug 2, 2012 at 0:48
  • Try copying it back and see what happens. The other thing you can do is in the build results window look for the first line that fails, then get the actual build line and post it here. I can only guess when you are building for the Simulator its trying to build 64bit x86...
    – David H
    Aug 2, 2012 at 0:51
3

I've solved changing in both the project and target build settings the key "Build variants" from "armv7" to "normal"

3

in addition to deleting all the files in this directory Users/your_usr_name/Library/Developer/Xcode/DerivedData/

i restarted my mac and it worked fine (restarting xcode and the simulator didn't cut it for me)

1
  • Same here. Rebooting the Mac was what finally did it. Jun 19, 2013 at 18:44
2

I was running into this same problem. In my case, it appeared to be that I had changed the Bundle Name for my multi-target project instead of the Product Name. Once I corrected that by editing the Project Name correctly and then setting the Bundle Name back to ${PRODUCT_NAME} it would run in the simulator again.

This may not be the answer for everyone, but it does appear that product naming errors (special characters, spaces, etc.) are a contributor for many, and that's what drove me to review the renaming that I had one.

1
  • exactly, in my case space char! Jul 16, 2013 at 19:53
2

I was facing the same issue with my project. Here's a brief explanation of the situation and my resolution. This may or may not work in your case.

I work at a place which has multiple iOS projects going. I recently had my system upgrade to Mac OSX 10.8 and Xcode 4.4.1. I was working on a project that was originally built on Xcode 4.1 for iOS 4. Since Xcode had iOS 4 simulators until 4.3, the project built and ran fine on all simulators. In Xcode 4.4.1 however, I did not find iOS 4 simulators and there is no easy way to install them either, which is why I was getting the "Cannot run on selected destination" error. Here's how I got my project to run.

  • Check under Build Settings > Architectures and set Architectures to Standard (armv7) or ${ARCHS_STANDARD_32_BIT} for all your profiles.

  • Set Base SDK to Latest iOS(<ios version #>) 5.1 in my case.

  • Set Build Active Architecture Only to NO for all profiles.

  • Set Valid Architectures to armv6 armv7 for all profiles. You may have to add either depending on what is already available.

  • Set iOS Deployment Target to iOS 5.1 (in my case) .

  • Make sure you have the same target under Deployment Target under the Summary tab of your project.

Clean and Run and cross fingers !!

2

In my case, the problem occurs after removing whole Resources folder, copying Resources folder from other or old project over current one then adding back that folder.

I solve the problem with the help from Analyse tool: after analysing, it warms me about Info.plist inside "Copy Bundle Resources".

Simply go to Copy Bundle Resource (at Build Phrase tab) delete Info.plist, then restart Xcode, clean and build. My project is back to normal.

Hope that help someones :)

2

I think a lot of these solutions force a full rebuild, which is what solved this for me.

I did Product => Clean, and the problem went away.

0
2

For me this worked:- Check all you product references are consistent in the settings and plists. Also check the product name does not contain any SPACE or other "illegal" characters.

1
  • Having a space in the Bundle Name was causing it for me! Thanks for the tip. Jun 3, 2013 at 15:29
1

try to rename your project. I solved by this way.

0
1

Judging from the responses this type of error has many potential sources, so here is my own (admittedly careless) version of the mistake (and simple solution):

  • XCode project Build Settings can be set at two levels: Project level, and Target level. For those less familiar, target level is where you have your executable app, and often other items like a dynamic library build.
  • In Linking section of Build Settings there is a option for Mach-O Type, where you can set Executable, Dynamic Library, Static Library, etc..
  • I was having trouble preparing a dynamic library, was scanning over the build settings for the project and saw Mach-O was blank. So I set to dynamic library. I then went on and reviewed a few more things and forgot I'd made this change. But I didn't realize I was at the overall Project Level, not the Target level for the actual dynamic library. This changed all target Mach-O settings to dynamic library.
  • And of course the executable target didn't like being treated as a dynamic library, and I got the OP's error message.
  • Setting the executable back to executable Mach-O at its target-level build settings fixed everything. Annoyingly the project-level setting still said dynamic library, but with correct target-level settings all worked fine.

Silly I know, but since a couple of the more drastic solutions listed above would have indirectly solved for this error I thought I'd share in case someone else had made the same mistake!

1

The way I solved this error was by a adding dummy function to my project. My issue was my app had no code of its own, only linked-in code.

I have an unusual situation with two projects: one "App" parent and one "Engine" child. All the compilable code is in the child and the parent simply links with the child, copying a ton of App-specific resources into the project.

Apparently this saddens Xcode, resulting in the above error.

My solution is adding this C function / file to the App project:

int workaround_for_xcode_reporting_cannot_run_on_selected_destination(){return 0;}

1

I restore the data from the time machine. Notice this is the exact same data that has been stored just 1 hour ago. The problem started yesterday. So it should be the EXACT same data.\

Yet it works.

1

I tried everything metioned here. Nothing worked. It seems that I somehow imported the Info.plist twice. To fix it I selected the project and pressed the "Validate Settings" button. Afterwards it works for me.

1

After a half day of experimenting, I think this means that the debugger can't find your executable to launch. I think this is an important distinction from the prior answers because its an underlying cause, that can have a lot of symptoms. In my case it couldn't reconcile the apps Info.plist for a custom build where we were copying the plist for the build. I changed the build setting to the Alt-Info.plist for AltDebug and that fixed it. Also meant no more copying.

Your underlying cause might be different, so the key takeaway is think about why Xcode might not be able to find your built app.

1

You'll be happy to know this problem has a very simple solution. Select Info.plist in your project navigator tree and make sure it is not assigned to a target. I have confirmed this is the correct solution. If building for iOS 6 or earlier you may also need to add armv6 to supported architectures

0

I had this issue after upgrading to Mountain Lion and XCode 4.4.1 for an OSX project. To resolve it, I had to upgrade my deployment target to 10.5 or higher; it was set to 10.4 and up.

0

You have to find in the "Activity Monitor" the Xcode process and kill it! I just did it to solve a similar problem!

1
  • Unfortunately it seems like this does not always help.
    – FD_
    Sep 30, 2012 at 10:43
0

I've got this problem after accidentally removing the Resources folder, when I added it again to the project, Bam !

I'm also running Mountain Lion and XCode 4.4 !

trying to find out what's causing this, but it seems to be reproduced when you delete then add the info.plist file ! can someone confirm that ?

0

I had the same problem after two things happened:

  • I upgraded to Facebook SDK 3.1
  • I updated my OSX (with a minor version update)

The only fix worked from me was adding armv7s (mind the "s" in the end!!!) Like was suggested here: https://stackoverflow.com/a/12540654/531527

0

Yet another variant solution: after trying just about everything in the list above, I fixed this by addressing a warning that the TestFlightSDK1 path could not be found. To do so, I deleted the relevant path from Header Search Paths (Build Settings>Search Paths) and removed the TestFlightSDK, and now things run just fine.

0

I had this from beginning and it looks like it is a problem that the emulator can not handle virtual smartcards. Unfortunately I ended up just using my Android phone connected via USB.

0

Remove Info.plist from the Copy Bundle Resource build phase.That worked for me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.