Xcode Cannot Run on the Selected Destination

后端 未结 30 2275
梦如初夏
梦如初夏 2020-12-02 18:22

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

相关标签:
30条回答
  • 2020-12-02 18:43

    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.

    0 讨论(0)
  • 2020-12-02 18:43

    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.

    0 讨论(0)
  • 2020-12-02 18:43

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

    0 讨论(0)
  • 2020-12-02 18:43

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

    0 讨论(0)
  • 2020-12-02 18:43

    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 讨论(0)
  • 2020-12-02 18:45

    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 讨论(0)
提交回复
热议问题