Xcode compiles my App, but can't run it in the simulator

后端 未结 20 1265
一向
一向 2020-12-05 01:59

when i compile my app, Xcode just says \"Attaching to Projectname...\" and gets stuck there. The debugger just prints this out:

error: failed to attac

相关标签:
20条回答
  • 2020-12-05 02:26

    I had similar issues when i installed XCode 4.5 on OS X Mountain Lion. I searched a while and tried some fixes but what finally solved the problem was adding "127.0.0.1 localhost" to my hosts file (/etc/hosts).

    Here is what i have done:

    Open a terminal shell with cmd+space > terminal
    type in "cd /etc"
    type in "sudo nano hosts"
    type in your root password
    add "127.0.0.1 localhost"
    save with ctrl+o > return
    close with ctrl+x
    log out and log in again or restart
    
    0 讨论(0)
  • 2020-12-05 02:26

    try to do next steps:

    • Go to Product/Scheme/Edit Scheme then select Run section.
    • Select Info Tan and set Debugger None.
    • Run project. It must be working (without debugger)
    • Go back to Edit Scheme and selecet debugger LLDB
    • Run project. It is working.

    Maybe additionally you need to delete derived data and do Product/Clean

    0 讨论(0)
  • 2020-12-05 02:27

    Make sure you do not have an invalid build rule, that will cause this error, happened to me once (I had added a build rule by mistake and left it invalid).

    0 讨论(0)
  • 2020-12-05 02:29

    Also make sure none of your file/group name collide with the projects default settings.

    Things started breaking for me when I added an info.plist file to my project (Bad Idea). Same happens when you add a "Resource" Group. I don't have an exhaustive list, but if someone does please do share.

    Cleaning out / Renaming these conflicting files and following the solution provided by Lindemann(https://stackoverflow.com/a/12504712/2069749) solved the problem for me.

    0 讨论(0)
  • 2020-12-05 02:30

    The solution for me was to delete everything Xcode has generated earlier:

    • the App on the Simulator...if this is not possible because you cant reach the Homescreen, you can delete the App directly under ~/Library/Application Support/iPhoneSimulator/6.0/Applications
    • delete the Derived Data in the Organizer under Projects or directly in ~/Library/Developer/Xcode/DerivedData
    • clean the Build Folder by choosing "Product" in the MenuBar and click while you press the Alt-key on "Clean Build Folder"
    • Restart Xcode
    0 讨论(0)
  • 2020-12-05 02:30

    If you are using a network account, you should replace the "~/Library/Application Support/iPhone Simulator" with a link to a local directory. This worked for me after trying everything else.

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