Xcode 4 hangs at “Attaching to (app name)”

最后都变了- 提交于 2019-12-17 06:21:50

问题


I just upgraded to Xcode 4 and for some reason my app won't run in the simulator or iOS device. It was working perfectly in Xcode 3, but all of a sudden now when I press run the program stops at "Attaching to...". There doesn't seem to be any other info to help with this problem either.

For summary you can try following things to tackle the issue:

  1. Restart the simulator.
  2. Make sure that you haven't included the Info.plist file in your Building Phases -> Copy Bundle Resources.
  3. Resources folder added to the project as a folder reference (the blue folder icon). That caused the trouble, after adding the folder as a group the problem went away.

回答1:


Fixed it!! Hopefully this helps some people avoid a very frustrating couple hours. I solved this by:

  1. Clicking on the project name in the left pane (at the very top). This will bring up a new menu to the right, something like the project/ target editors in XCode 3.
  2. Click on Build Settings up at the top.
  3. Under Packaging make sure your product name is the same for every build, and equal to whatever it says it's attaching to. Eg if XCode is Hanging at "Attaching to myLCBO" but your product name is "LCBO Finder" then it won't build. That was exactly my problem because I renamed my app half way through development.

Hope this helps!




回答2:


Here was our fix:

In Project > Edit Schemes > Run.

Change the Debugger from GDB to None (directly above the green circle in the image above).




回答3:


A tip I found at the Apple Developer Forums:

Go into your ProjectName.xcodeproj/ directory and delete anything named with your userid. Re-open the project in xcode and all that will get recreated and it should work. At least it did for me.

Another tip is to manually delete the build directory.

Yet another tip is to navigate to the Organizer (Shift ⇧ Command ⌘ 2 in xcode 4), select Projects, select you application in the left hand side and then the Delete...-button to the right of Derived Data.

And never forget the universally useful tip: restart your computer and try again.

Good luck!




回答4:


Solution provided didn't fix the problem in my case.

In order to solve it (XCode 4 only), I had to go to Product -> Edit Scheme. Then select the "Run " scheme, and marked "Automatically" which wasn't enabled.

Hope it helps someone.




回答5:


For everyone still trying to resolve this after everything you tried from above, try starting iphone simulator, clicking iOS Simulator in menu on top, Reset Contents and Warnings. This will erase all apps from simulator, but now you can finally use simulator!




回答6:


Restarting simulator works for me :)




回答7:


Also: make sure that you haven't included the Info.plst file in your Building Phases -> Copy Bundle Resources. If so, remove it from that list! I small mistake which could happen, but something that messes things up quite nasty :S




回答8:


One more possible solution: I had my Resources folder added to the project as a folder reference (the blue folder icon). That caused the trouble, after adding the folder as a group the problem went away.




回答9:


I really find the answer for me :)

for me,

project setting -> your target -> build phases -> validate setting -> perform

and now the problem is gone.

:)

I hope someone it help




回答10:


Like Rob said, but also check the "identifier" should read by default "com.yourcompany.YourAppName" I had changed the "yourcompany" by mistake and this caused the same issue noted above.




回答11:


I solved this problem how:

1) iOS Simulator->Reset Contents and Settings...

2) Sure project name, scheme name and target name is identical. "AppName" and "Appname" is not true. Must be "AppName" and "AppName", or "Appname" and "Appname".

3) Restart XCode and Quit Simulator.

Project name at Build Settings->Product Name.

Scheme name at Product->Manage Schemes. Click on current scheme once for rename.

Target name at Column of Project with Targets. Click once on current target for rename.

Good luck =)




回答12:


This also seemed to happen to me when the info.plist file was in the copy build phase. It appears that sometimes Xcode will warn you about this, and other times it won't. Very strange. But if you are experiencing this issue, make sure that info.plist is NOT in your copy build phase.




回答13:


This solution is not technical but it worked for me.

When Attaching to Process shows up in xcode and it hangs for a while, just quite the iOS simulator and re-launch the app by pressing Command + R.

It will launch the app without any issues :)




回答14:


I tried everything and nothing worked. I have an old project from XCode 3. I simply renamed info.plist in the project to another name, restarted the simulator and everything is working fine since.




回答15:


I frequently encountered this problem after renaming a project in Xcode 4.

I was able to fix it by editing the Bundle Identifier in the .plist file.

After I renamed the project, the Bundle Identifier would change to something like this:

com.yourcompany.${PRODUCT_NAME:rfc1034identifier}

changing it back to this:

com.yourcompany.${PRODUCT_NAME}

will stop Xcode from hanging and allow the App to run.




回答16:


For me, none of these has worked. I realized that my project had 2 info.plist files (with two different names, like info.plist and Project-info.plist), so XCode got confused. I just removed the incorrect plist file, and it worked!




回答17:


My problem was also a folder named "resources" on the root source folder. Looks like it conflicts with some internal build naming.

Renaming the folder to "res" solved the problem for me.




回答18:


I tried everything in this page, and the "new" solution that worked for me was to go into the simulator, and "Reset Content and Settings" in the iOS simulator main menu.




回答19:


Under Product > Edit Scheme > Run > Info, changed the Debugger from LLDB to GDB worked perfect for me!




回答20:


I had the same problem. The issue was there was one more user who was logged in and had the simulator running. Think there can be only one instance of iphone simulator running on a machine even for different users. Hope this info would be useful for somebody :)




回答21:


What worked for me is the following:

In XCode:

  • Click on project name
  • Click on target name
  • Click on "Build Settings"
  • Reveal "Product Name" contents (click on triangle)
  • Make sure the name of all items matches that of project name
    • Example
      • Product Name myapp
        • Debug myapp
        • Release myapp
  • Reveal "Deployment" contents (click on triangle)
  • Make sure there is a "IOS Deployment Target" item
    • Example
      • IOS Deployment Target IOS 3.0
        • Debug IOS 3.0
        • Release IOS 3.0

Then clean and run.




回答22:


This is what worked for me:

In Xcode navigate to the Product menu and choose EDIT SCHEMES.

In the list on the left choose Run YourAppName.app. From the Executable menu choose OTHER.

Navigate and choose your .app file in your project directory.

Now run and it works :)




回答23:


I noticed it happened to me when I edited the scheme from Build Release to Build Debug. I changed back, and it worked :)




回答24:


What worked for me:

  • Launch "Monitor" and kill gdb-i386-apple-darwin which was supposedly hung
  • Restart iOS simulator




回答25:


My solution is correcting the nib name. (I changed my nib name before for an iPad version but then I deleted the iPad nib file). Then it works well again.




回答26:


All of the above suggestion didn't resolve my problem. After I added the Resources folder and and compile, it hangs on attaching to app-name. I removed Resources folder, still hang. I removed the project and recreate a new one ( with the same name ) but still having problem. If it was different name then it's ok. I restarted the OS but still doesn't help.

To solve the issue, I did the following: 1. ps -ef | grep Xcode, and kill all the "Xcode" processes. 2. Reset the content of Simulator, and quit the Simulator. 3. Product > Clean to clean up the build. 4. Compile and run the product. It should work at this point.

Hope it helps some else having this similar issue.




回答27:


I encountered this error after incorporating another project inside my new one. Make sure you delete the project that you have added's info.plist and .app




回答28:


Just came across the same problem: restarting the simulator and Xcode didn't work for me, while restarting my mac worked out pretty well!




回答29:


The best option would be

  1. Quit Simulator
  2. Open Another Project
  3. Run Project (just for the sake simulator opens)
  4. Delete the earlier project from simulator
  5. Clean the main project
  6. Run again

Enjoy!!!




回答30:


If your app still doesn't work after changing Product Name, try to change "Executable file" also. I'd solved same problem with this method.



来源:https://stackoverflow.com/questions/5382968/xcode-4-hangs-at-attaching-to-app-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!