Xcode Cannot Run on the Selected Destination

IosXcode

Ios Problem Overview


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

Ios Solutions


Solution 1 - Ios

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.

Solution 2 - Ios

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.

Solution 3 - Ios

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.

Solution 4 - Ios

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

Solution 5 - Ios

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

Solution 6 - Ios

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.

Solution 7 - Ios

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.

Solution 8 - Ios

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

Solution 9 - Ios

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!

Solution 10 - Ios

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

Solution 11 - Ios

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)

Solution 12 - Ios

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.

Solution 13 - Ios

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 !!

Solution 14 - Ios

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 :)

Solution 15 - Ios

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.

Solution 16 - Ios

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.

Solution 17 - Ios

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

Solution 18 - Ios

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!

Solution 19 - Ios

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;}

Solution 20 - Ios

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.

Solution 21 - Ios

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.

Solution 22 - Ios

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.

Solution 23 - Ios

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

Solution 24 - Ios

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.

Solution 25 - Ios

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

Solution 26 - Ios

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 ?

Solution 27 - Ios

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

Solution 28 - Ios

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.

Solution 29 - Ios

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.

Solution 30 - Ios

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

Solution 31 - Ios

For me its duplicate entry of info.plist caused same problem.

Removed Icon files triangle from info plist and worked.

Solution 32 - Ios

Everything above didn't work, but this did:

  1. Make sure you have all your (non ignored) files under git

  2. My .gitignore looks like this

    *.xcworkspace
    xcuserdata
    .DS_Store
    Pods
    
  3. Make a backup of MyProject.xcworkspace somewhere

  4. Remove MyProject.xcworkspace and MyProject

  5. git reset --hard HEAD

  6. Copy MyProject.xcworkspace back to your working directory

  7. pod install

  8. Rebuild!

Solution 33 - Ios

between trying the other answers here and doing what this answer said I seemed to have fixed this issue

Solution 34 - Ios

i have this problem and apply different solution but it is of no use, so i find the solution of this problem,Perform these steps

1- add architecture in build setting armv6 2- just make validate setting 3- clean code 4- build and run

cheers

Solution 35 - Ios

if You are using With Xcode 8 Beta then you have to change following things:

-Select project and to go target build settings

  • Enter the key "Build variants" to search box
  • and just changed from "armv7" to "normal" or reverse it.

Solution 36 - Ios

Worked for me.

  1. Drag your repo to the trash and then re-clone it.
  2. delete your app on your device.
  3. re-attach and run. It should work.
  4. Find a punching bag to alleviate your frustration and resist the urge to commit a serious crime.

Solution 37 - Ios

change supported platform -> debug to : IOS enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionazamsharpView Question on Stackoverflow
Solution 1 - Iosx4h1dView Answer on Stackoverflow
Solution 2 - IosFranView Answer on Stackoverflow
Solution 3 - IosdemonView Answer on Stackoverflow
Solution 4 - IostipycalFlowView Answer on Stackoverflow
Solution 5 - Iosmohammad alabidView Answer on Stackoverflow
Solution 6 - IosBobjtView Answer on Stackoverflow
Solution 7 - IosptkView Answer on Stackoverflow
Solution 8 - IosяοвοτағτєяаււView Answer on Stackoverflow
Solution 9 - IosDavid HView Answer on Stackoverflow
Solution 10 - IosGigisommoView Answer on Stackoverflow
Solution 11 - IosabboodView Answer on Stackoverflow
Solution 12 - IosVraminView Answer on Stackoverflow
Solution 13 - IosunspokenblabberView Answer on Stackoverflow
Solution 14 - IosTonyView Answer on Stackoverflow
Solution 15 - IosNickView Answer on Stackoverflow
Solution 16 - IosAnishView Answer on Stackoverflow
Solution 17 - IosCan AksoyView Answer on Stackoverflow
Solution 18 - IosthomasView Answer on Stackoverflow
Solution 19 - Iosncr100View Answer on Stackoverflow
Solution 20 - Iosuser4234View Answer on Stackoverflow
Solution 21 - IosXazenView Answer on Stackoverflow
Solution 22 - IosEric RuckView Answer on Stackoverflow
Solution 23 - IosjcpennypincherView Answer on Stackoverflow
Solution 24 - IosWez FurlongView Answer on Stackoverflow
Solution 25 - IosNicolaiView Answer on Stackoverflow
Solution 26 - IosMostafa BergView Answer on Stackoverflow
Solution 27 - IosLior FrenkelView Answer on Stackoverflow
Solution 28 - IosbeaudrykockView Answer on Stackoverflow
Solution 29 - IosMarkus ZellerView Answer on Stackoverflow
Solution 30 - IosMihaela MatesView Answer on Stackoverflow
Solution 31 - IosGuruView Answer on Stackoverflow
Solution 32 - IosmashView Answer on Stackoverflow
Solution 33 - IosFonixView Answer on Stackoverflow
Solution 34 - IosMuhammad ShauketView Answer on Stackoverflow
Solution 35 - IosPravin KambleView Answer on Stackoverflow
Solution 36 - IosScottyBladesView Answer on Stackoverflow
Solution 37 - IosMortada JafarView Answer on Stackoverflow