I just upgraded to Xcode 4 and for 开发者_如何学Pythonsome 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:
- Restart the simulator.
- Make sure that you haven't included the Info.plist file in your Building Phases -> Copy Bundle Resources.
- 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.
Fixed it!! Hopefully this helps some people avoid a very frustrating couple hours. I solved this by:
- 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.
- Click on Build Settings up at the top.
- 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.
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).
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!
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.
For everyone still trying to resolve this after everything you tried from above, try reseting the iPhone Simulator.
Simulator > Device > Erase All Content and Settings...
This will erase all apps from simulator, but now you can finally use simulator!
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
Restarting simulator works for me :)
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.
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
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 =)
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.
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.
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.
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.
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 :)
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.
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.
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!
Under Product > Edit Scheme > Run > Info, changed the Debugger from LLDB to GDB worked perfect for me!
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 :)
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
- Product Name myapp
- Example
- 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
- IOS Deployment Target IOS 3.0
- Example
Then clean and run.
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 :)
I noticed it happened to me when I edited the scheme from Build Release to Build Debug. I changed back, and it worked :)
What worked for me:
- Launch "Monitor" and kill gdb-i386-apple-darwin which was supposedly hung
- Restart iOS simulator
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.
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.
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
Just came across the same problem: restarting the simulator and Xcode didn't work for me, while restarting my mac worked out pretty well!
After all said and done. I had to stop the simulator. Then the message change to downloading Mac OS X 10.6 core library.
Create a new user account, switch to account, open XCode and try running the project. After trying all of the other suggestions with no success, not only was I again able to run on sim, but the original account now works.
精彩评论