Xcode Crashing When Opening Project File

為{幸葍}努か 提交于 2019-11-27 09:58:01

问题


Xcode keeps crashing on me when I open my project file. I've been able to open it fine for weeks now. Not sure how to diagnose. It only crashes for a specific project.

Process:         Xcode [1293]
Path:            /Developer/Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:      com.apple.Xcode
Version:         3.2.5 (1760)
Build Info:      DevToolsIDE-17600000~5
Code Type:       X86-64 (Native)
Parent Process:  launchd [189]

Date/Time:       2010-12-15 16:05:24.659 -0700
OS Version:      Mac OS X 10.6.5 (10H574)
Report Version:  6

Interval Since Last Report:          201 sec
Crashes Since Last Report:           4
Per-App Interval Since Last Report:  80 sec
Per-App Crashes Since Last Report:   4
Anonymous UUID:                      2B7F7CFC-45EA-450C-8467-6BF1E356B6F6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000025940
Crashed Thread:  10  Dispatch queue: com.apple.Xcode.index-access

Application Specific Information:
objc[1293]: garbage collection is ON

回答1:


The crash is generally a sign the project file has been corrupted. Here's a list of possible things you can do to try to fix it.

1. Fix a corrupted *.pbxproj file

Caused by a merge conflict

If you are using version control, it might be caused by a merge conflict that has not yet been resolved.

  1. Using Finder, open the directory that holds your project.
  2. Right click the project file YOUR_PROJECT_NAME.xcodeproj and Open With your preferred text editing tool such as Sublime Text.
  3. Look for merge conflicts which are usually marked using a series of ========= bars.
  4. Resolve the merge conflicts manually or remove the changes of one side.

Caused by unreadable XML

If that fails go into the file and quickly scroll through to see if anything seems out of place - it should generally be readable XML. You could even try an XML validator against it to see if anything amiss was found.

2. Reset your workspace

  1. Using Finder, open the directory that holds yor project.
  2. Right click the project file MyProject.xcodeproj and choose Show Package Contents.
  3. Delete the xcuserdata folder, which should contain a folder with your username on it.
  4. Repeats step 2 and 3 for your workspace file MyProject.workspace

As elaborated by KennyWinker and Paul R on the answers below.

3. Recreate your Xcode project

Note that this should be your last resort as it is quite tedious to do for large projects.

Lastly you could simply re-create it. That might seem like a big pain, but basically you could just create a new project and drag everything under the "Classes" folder into Xcode to start using it (don't forget to also add the frameworks you need).




回答2:


Just wanted to elucidate on @Paul R's comment.

I had a situation where Xcode was crashing every time I opened a project file. It seemed to be connect to the IB window that was opening. In the end it was deleting the contents of MyProject.xcodeproj/project.xcworkspace/xcuserdata/ that solved this. It did this by resetting the workspace (open files, window scaling, etc.)

Hope this is helpful.




回答3:


What worked for me?

The only solution that worked for me was deleting the derived data folders of the hanging project, i.e the derived data folders in above directory: ~/Library/Developer/Xcode/DerivedData/. Hope it helps someone.

What didn't?

As mentioned at other places, deleting MyProject.xcodeproj/project.xcworkspace/xcuserdata/ or MyProject.xcodeproj/xcuserdata/ didn't work for me.




回答4:


Just wanted add some extra content to @Kenny Winker answer...

To delete your xcode user data go,

  • Find your Xcode project file ex: MyProject.xcodeproj or MyProject.xcworkspace
  • Right click on it and choose Show Package Contents
  • Finally, just delete everything inside the folder xcuserdata
  • Done! :)

Hopefully, this adds a bit more context to people who doesn't know where to find their project user data.




回答5:


I had similar problem with Xcode 8.1. The reason maybe the project file contains merge conflict data. You can remove this by opening Xcode project file in TextEdit.

However, in my case there was no merge conflict. Simply deleting content of DerivedData worked for me.

Steps :

  1. Open finder window then select Go Tab -> Go to Folder… (or press Cmd + shift + G)

  1. Enter ~/Library and press Go. This opens Library folder which is hidden by default.

  1. Go to Developer -> Xcode -> DerivedData folder. Delete all the content of this folder. The DerivedData is like cache i.e. create every time you build/run your app.

  1. Now open the project. It should work with no issues.



回答6:


Copying Answer of @Sean D which worked for me.

After seeing a suggestion here, I solved this issue by deleting Xcode's preferences. The most reliable way to do that is the following terminal command, issued after quitting Xcode:

defaults delete com.apple.dt.Xcode

ETA: Other suggestions have involved changing or removing certain individual preference settings, but after trying a few of those, none worked for me. There seem to be multiple incompatibilities in the preferences between 6 and 7b3, so trashing the prefs entirely should work around them all.




回答7:


Same thing happened to me, and it was some sort of versioning issue that I couldn't fix, so I reverted back to a prior version and it worked. Feels like there are a few bugs in XCode 4 that still need to be worked out.




回答8:


I had XCode crashing every time I opened Images.xcassets. The solution was to delete a corrupt PDF file I had just added.




回答9:


Computer restart

worked for me. While

xcuserdata deletion

and

defaults delete com.apple.dt.Xcode

didn't work for me.

I even was not able to open xcode alone or any of my projects or single .m file.




回答10:


If you have any open swift file in a new window (for example when you double click on a .swift file in xCode and it opens in a new window) when xCode opens this might be an issue. I think I had this window opened when closing xCode, then when opening xCode this window opens up again and for some reason crashes xCode. Try to close that open window quickly before it crashes. Strange, but that worked for me.




回答11:


i tested a lot of ways but after of all i just and only change the directory of my project location every thing fixed and my Xcode works properly and I'm glad now....




回答12:


I experienced XCode crashing when trying to edit a specific original.m file. None of the above solutions worked, but this did:

  1. Create a new .m file as new.m for example.
  2. Using a text editor open up original.m outside XCode, copy contents and paste into new.m inside XCode. Go back to working in XCode.
  3. Delete and move to trash the original.m
  4. Rename new.m to original.m
  5. Now I can edit original.m without XCode crashing.



回答13:


In my case there were two windows, one on the internal screen of my MacBook and one on an external each with several tabs opened before Xcode crashed and kept crashing on trying to open the xcworkspace file. The above mentioned solutions did not work. After disconnecting the external display, Xcode started without crashing and both windows were placed on the MacBook's screen. Reattached the display and everything worked as before.



来源:https://stackoverflow.com/questions/4455903/xcode-crashing-when-opening-project-file

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