Xcode Cannot Run on the Selected Destination

后端 未结 30 2276
梦如初夏
梦如初夏 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:39

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

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

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

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

    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.

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

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

    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!

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

    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.

    0 讨论(0)
提交回复
热议问题