Xcode Crashing When Opening Project File - xcode

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

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.
Using Finder, open the directory that holds your project.
Right click the project file YOUR_PROJECT_NAME.xcodeproj and Open With your preferred text editing tool such as Sublime Text.
Look for merge conflicts which are usually marked using a series of ========= bars.
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
Using Finder, open the directory that holds yor project.
Right click the project file MyProject.xcodeproj and choose Show Package Contents.
Delete the xcuserdata folder, which should contain a folder with your username on it.
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).

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.

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.

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.

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 :
Open finder window then select Go Tab -> Go to Folder… (or press Cmd + shift + G)
Enter ~/Library and press Go. This opens Library folder which is hidden by default.
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.
Now open the project. It should work with no issues.

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.

I did every solution on the thread. But nothing helped me. Don't know why.
Instead of opening the project through Xcode, I opened the project through the terminal using open Project.xcworkspace, it magically works.

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.

Inside your project folder find projectName.xcodeproj or projectName.xcworkspace if you have installed pods right click on it and click on (Show package contents) and finally delete everything inside xcuserdata folder
Launch your project it will work fine

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

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.

I was also facing same issue, I did every things like below but didn't work for me!
Deleting the derived data:
~/Library/Developer/Xcode/DerivedData/
Delete everything inside the folder xcuserdata:
MyProject.xcodeproj/project.xcworkspace/xcuserdata/
and
MyProject.xcodeproj/xcuserdata/
What worked for me?
In my case I have reinstalled Additional Component(Additional downloads) from below link then solved this issue.
https://developer.apple.com/xcode/resources/

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.

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....

I experienced XCode crashing when trying to edit a specific original.m file. None of the above solutions worked, but this did:
Create a new .m file as new.m for example.
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.
Delete and move to trash the original.m
Rename new.m to original.m
Now I can edit original.m without XCode crashing.

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.

I you use Cocoapods try pod deintegrate, delete the workspace, then pod install. This cured it here (Talking of Xcode 11.2.1 after upgrading the Mac to Catalina and the following crashing Xcode)

Towards a cocoa pods included project, I resolved this issue by renaming workspace file and running "pod install" on terminal again.

I was also facing same issue, everytime xcode was crashing. i restarted mac, cleared derived data/xcuserdata but nothing worked.
I had one more repo so i copied 'project.xcodeproj' file from there and paste it in current repo, this trick resolved my problem.

Go to project -> right click on .xcodeproj -> show package contents -> delete all files in xcuserdata.
Quit the xcode -> reopen
Delete the

Open project in previous version of Xcode and then close it and reopen it on Xcode version that you are using for project,
suppose you are using Xcode 11.1 and it is getting crashed while opening projects, then open it in Xcode 10.0 or 10.1.

Fix a corrupted *.pbxproj file
Reset your workspace
defaults delete com.apple.dt.Xcode
do 1~3 and
git clone ~~~.git newGitProject
copy MyProject.xcodeproj, MyProject.xcworkspace
go to GitProject
paste MyProject.xcodeproj, MyProject.xcworkspace
worked for me.
if you have git repository , try it ;)

Related

Xcode 9 Autocomplete Not Working 100% - Partially Working

This morning, Xcode 9.0 (9A235) shows a new/strange Auto Complete box that is not at all what it used to be. How do I get the full auto-complete box so that autocomplete looks like how it usually does?
Try:
Go to Xcode > Preferences > Text Editing
Under Code completion - Uncheck 'Suggest completions while typing'
Quit out of Xcode and then relaunch Xcode.
Go to Xcode > Preferences > Text Editing again
Quit out of Xcode and then relaunch Xcode.
Now go to Code completion and check 'Suggest completions while typing'.
Try typing library function or enum and enjoy!
Deleting the DERIVED DATA folder seemed to fix my issue. Thanks to this post: swift println() not showing autocomplete options while writting code
Things to try:
#1
Run this command in the project directory if you use cocoapods:
rm -rf ~/Library/Caches/CocoaPods;
rm -rf Pods; rm -rf ~/Library/Developer/Xcode/DerivedData/*;
pod deintegrate; pod setup; pod install;
#2
**Clean Cached Data**
Clean the Project -> Cmd+Shift+K
Clean the Build Folder -> Cmd+Shift+Option+K
If you skipped step one:
Delete Derived Data
Xcode Preferences -> Locations ->
Arrow Symbol Takes you to DerrivedData -> Delete Folder
#3
**Check your Build Phase's Compile Sources.**
Every .swift and .m file in the project should be in this list or it won't autocomplete in those files.
#4
**Optimize your Editor:**
Use fileprivate* on every class property and function that you can to reduce the scope of the Compilers work per item.
Write modular/OOP code so you have less code for the compiler to read.
Avoid using Type Inferance when the result is a complex calculation, and try to break down complex calculations into let this = smallerOperation statements
* In Swift 4 private became stricter than fileprivate
In Xcode 12 there have been significant improvements in how often deleting derived data is necessary (though freezing has increased).
Xcode Version 11.0 (11A420a)
I have tried the solution from Lal Krishna for Xcode V11.0. It worked a few times but later I got no result.
I found one solution. You must delete two files:
Library/Developer/Xcode/Derived Data (as described before)
Library/Developer/Xcode/UserData/IDEEditorInteractivityHistory
That solution helps me now. May be useful for others 😉
This can happen when the file is not a member of the Target. Open the file where autocomplete is not working and show the the "Utilities" tab in the top right of Xcode (blue in the screenshot below).
Ensure your Target (typically your app's name) is checked. Autocomplete should work almost instantly without restarting Xcode, cleaning, or deleting Derived Data.
If it is already checked, make sure to uncheck and recheck it again. For me, it did the trick.
I'm using Xcode 10.2 and I had the same issue.
This answer from axel helped me to fix.
Anyway, I'm going to describe a bit more:
Go to YourProject.xcodeproj by clicking with Right Mouse Click and open Show Package Contents
Go to xcuserdata and delete your youruser.xcuserdatad
If you have also the xcworkspace(if you already have any pods installed) then do step 3&4, if not then just skip step 3&4:
Go to YourProject.xcworkspace by clicking with Right Mouse Click and open Show Package Contents
Go to xcuserdata and delete your youruser.xcuserdatad
Quit Xcode
Delete Derived Data by using Terminal:
rm -rf ~/Library/Developer/Xcode/DerivedData
Open Xcode and check if it works.
This can also happen if you redundantly named your files. For example,
Data.swift
Data.swift
Here's a bit of workaround but works.
Clean the project... Command + Shift + K
Clean the build folder... Command + Shift + Options(Alt) + K
Delete derived data for the project...
This can be done with the help of this link:
How can I delete derived data in Xcode 9?
Close XCode.
Reopen XCode (let the indexing complete) and Build the project... Command + B
Once it will be done with building, The suggestions will be back. I have tried it twice.
Update:
Sometimes the issue can be as simple as Duplicate file names.
Carefully check if any new file names added by you are conflicting with older files.
In Xcode 11.4, even if you move an existing file to another group, the suggestions disappear. This can be cured simply by restarting Xcode.
Removing the file from the Test Targets fixed my problem.
After a long time of searching, I finally fixed the issue for me. In Xcode > Preferences > Text Editing, in "Code Completion", I had "Use Escape key to show completion suggestions" checked for some reason. As soon as I unchecked this box, auto completion worked like a charm, without even needing to restart Xcode! (Xcode 10)
Please try doing this:
Select the file >> check if the file is added to UITesting or UnitTesting targets (File inspector -> Target Membership). If so, please uncheck those two and make sure only the project target is selected. Then build and try if autocomplete is working fine.
This worked for me. Hope it help someone.
For Xcode 11.4 (11E146)
Back Slash in folder name breaking the autocompletion feature, If this is the case remove it and build again.
I added here what was going on in my project just in case it can help someone else... I had 2 files with the same name and I didn't realise.
Just lost a day trying to solve the autocomplete nightmare of Xcode (9.2). Deleting derived data seemed to work briefly then things reverted. Reboots etc and other suggested voodoo failed to make a difference.
I gave up and download the 30 day trial of AppCode from Jet Brains. Autocomplete worked fine there and this maybe coincidence but it then started working again in my project in Xcode. Can't guarantee that it'll keep working...
It seems to be file specific in my case (Xcode 9.2) For me the fix was:
Delete problem file (remove reference)
Clean and Build
Add file back into the project (I did not check test targets)
Build again
Finally after 3 hours of trying everything - autocomplete works as it should.
Problems mostly because there are missing location of some files in project navigator (build errors)
Press command+1 to open Project Navigator pane
Check if there are any missing files
Or you can:
Delete DerivedData (command+shift+K)
Clean build folder (command+shift+option+K)
Press build again (command+B)
You should see build error that Xcode could not find some files that prevent build tool to process auto complete.
Correct and fix any missing files that you see.
Hope this helps
Use Command + B
or Command + R to Build or Run the project
Xcode sometimes messes up ;)
Xcode 11.3, macOS catalina
process parsecd achieve 100% of cpu, so kill it helps me
goto underneath directory and delete all folders on it.
{Your User}/Library/Developer/Xcode/DeriveData
It worked for me.
For me it was happening in my test file, because it wasn't part of a target for some reason. Setting it's target membership solved the issue.
For me, the problem occured when I discarded all the changes of one file (under Source Control > Commit), which effectively deleted the file. This is what I wanted and I thought that the file and all references to it would be delted too.
However, there was still a reference to the file (shown in red) in the Project navigator. Deleting the (now non-existant) file in the Project navigator magically brought auto-completion back.
No amount of cleaning, deleting derived data, etc helped. I only realized the deleted file was still showing when I tried to build my project, which of course failed because it couldnt find that file.
Hope this will help someone save 30 minutes :)
check whether you selected the Suggest completions while typing in Xcode -> Preferences -> Text Editing
navigate to user->Library->Developer->Xcode->DerivedData in Finder and delete the DerivedData folder
My case might appear too specific to help, but it might give someone an idea of how to solve broken auto-completion. Xcode 10.2.1.
In my case, auto-complete stopped working entirely and non of these other answers helped me. In addition, the fan on the computer could be heard to go louder indicating something was overworking (no other apps running), it should be noted I was editing on a MacBook Pro laptop. It seemed to be linked with the editor struggling to parse the equation I'd written:
switch mtype {
case .indeterminate:
newPosition.x = (frame.width - mainFigureText.frame.width) / 2
case .right:
newPosition.x = (((frame.width / 2) - mainFigureText.frame.width) / 2) + (frame.width / 2)
case .left:
newPosition.x = (((frame.width / 2) - mainFigureText.frame.width) / 2)
}
I was looking to animate a text view left, right, or to the middle depending on user prefs. The newPosition is a CGPoint that the text will animate to. Anyway, I split the equations up and all of a sudden auto-complete started working and the fan went quiet! I've been able to recreate this specific problem more than once by re-typing the above code and then replacing it with:
let halfFrameWidth: CGFloat = frame.width / 2
let middleLeft = (halfFrameWidth - mainFigureText.frame.width) / 2
switch doseType {
case .right:
newPosition.x = middleLeft + halfFrameWidth
case .left:
newPosition.x = middleLeft
default:
newPosition.x = (frame.width - mainFigureText.frame.width) / 2
}
I would like to add one more to the pile of solutions, because it is the only one that worked for me and is nowhere to be found here.
Xcode normally comes with two default build configuration for every project. Release & Debug. I have an extra one for my unit tests called Testing. In Xcode 10.1, 10.2, 10.3 and 11 beta, the new build system does not seem to like it and will only auto-complete if you either use Release or Debug. Any custom build configuration breaks auto-completion in mixed (swift + objc) project with unit tests.
I faced the same problem in Xcode 11.3.1. In my case The issue was cause due to duplicate file names / Deleted file name. Better to run the application once and check whether there are any deleted files/classes so that you will get a syntax error.
This Link helped me. Open the Build Settings & fill the framework search paths. See the below image.
Build errors can break the autocompletion feature in Xcode.
I had the issue with 100% not working auto-complete, none of written here helped. One thing I noticed – it was broken right after adding some entities into .xcdatamodel file, which have codegen class definition by default.
So I wasn't surprised when using old-style codegen none (and generating classes of course) fixed the issue immediately, even without restarting the xcode.
With Xcode 11.1, simply performing Clean Build Folder or deleting derived data was not enough to fix autocomplete.
Only after restarting my Mac, everything was back to normal
If you have issue with weird completion/auto-completion/intellisense (not showing default stuff like delegates and datasource protocols methods) just change your target (e.g. from simulator iPhone 8 to real device), build the project and switch back to your original target.
Similar with issues with Interface Builder (storyboards) not showing anything, but only "nothing selected" whenever you select any part of the view. Just switch to other Xib/Storyboard (or even create new), check if it works there and switch back.
These workarounds worked for me in both cases (had both issues in one day with one project on Xcode 10.2.1). From what I've seen all over internet forums it seems these are bugs never fixed since Xcode 6.x or so.
Cheers!

Xcode 8.2.1 becomes unresponsive when i click on main.Storyboard

First, there's one old question with the same issue, but since the answers don't work for me, i'm posting this one:
I had problems to open an old project at all. So i deleted xcuserdata and the derived data, from the options tab, too. This one worked fine and i was able to open the project, but now when i click on the storyboard Xcode "hangs" and i have to force it to quit.
This happens only if i click on main.Storyboard, every other file in the project works fine when i click on it.
The last thing i tried was to run the project and in the last 5 minutes, it says Compiling 2 of 2 Storyboard files and that's all; no other result at the moment.
edit: cleaning the project doesn't work too.
edit2: It seems the problem is with my Xcode, not the project. I created a new project and Xcode freeze when i try to open the storyboard. Same with some other old projects.
Next step: reinstalling the Xcode.
Ok, like i comment previously, i tried a lot of things before consider to reinstall Xcode, but the most important were to run the project in other Mac and when i saw that there was no problem to show the storyboard i concluded that the issue were in Xcode.
I reinstalled it and it works fine.
Before everyone does that it's probably a good idea to see if your project run on other mac.
You can also delete xcuserdata, the derived data and the Xcode saved state.
Among the other things i tried:
I restored the version of main.storyboard i have on time machine, just before the crash. Didn't worked, but worth to try.
I also considered to replace the file with the same but from some old version. But the problem was, that i've made too many changes on the actual storyboard, so i needed to find a way to restore it.

Xcode indexing does not finish

I am having a small project just for testing. After a few days of testing the "indexing process" of Xcode broke, it simply does not finish. I tried it with another project, same thing. I tried to reinstall Xcode -> Did not help, I deleted the Derived Data -> Did not help. Restarting Mac + Xcode -> Did not help. Is there anything else I could try ? Thanks for every tip, this problem really kills the dev process.
Apparently the following has worked for several people.... Hope it helps you! PS:I'm trying it right now
Open your Project Folder.
Find ProjectName.xcodeproj file.
Right-Click Copy and Paste to Safe Place.
Right-Click Show Package Contents.
Find project.xcworkspace file and delete that file.
Reopen Your Project and clean and Rebuild.
If your problem is not solved than replace the file with your backup file.
In my case, I solved that problem by just closing assistance editor and selecting another source file in Xcode. It was useless to empty /DerivedData folder, cleaning project, rebooting OS or reverting to the previous project. After closing assistance editor and selecting another source file in the project navigator, Xcode successfully completed the indexing. Before then I opened Info.plist with viewController.m source file in Assistance Editor. My Xcode version is 9.4.1.

Xcode: No Scheme

I recently opened project in Xcode is now saying I have No Scheme:
When I try and Manage Schemes I am unable to Autocreate Schemes Now (a separate post but possibly related) and no Schemes are listed:
and when I try and add a Scheme I get dialog saying Target None.
What's going on and how do I fix my Xcode project?
Close Xcode and delete the folder <username>.xcuserdatad from within <projectname>.xcodeproj/xcuserdata/. Then restart Xcode, the schemes should re-appear.
EDIT:
You may need to delete from .xcodeproj file and .xcworkspace file
This worked for me
Click on No Scheme
Click on Manage Scheme
Click on Autocreate Schemes Now
I think this is happening when you are opening the app.xcworkspace not app.xcodeproj.
Solution:
Install the pod and open the app.xcworkspace again.
Close Xcode ["Force Quit Applications" (cmd+option+escape) to ensure]
Remove derived data of app (Xcode 9.4: Users/[username]/Library/Developer/Xcode/DerivedData/[app directory to delete])
Remove .xcworkspace from project directory
Also in project directory: .xcodeproj -> Right Click -> Show Package Contents -> remove .xcworkspace if exist -> xcuserdata -> remove [username].xcuserdatad
It should do the trick. Install pods if needed and open project. Target should be available again.
Use shortcut ctrl+cmd+[ or restart.
For me following worked
Go to your Project Directory and right click on the
.xcodeproj or .xcworkspace file and select Show Package Content
and delete xcuserdata.
don't forget to restart the Xcode
If it do not work and you have CocoPod in your project run the following Command
Pod install
The top answer fix didn't work for me when running the Xcode 8 beta's. but what did work was unplugging a connected device (iPhone, iPad etc.) and re plugging back in. The schemes would then reappear.
If you are using pods and using the correct workspace what I found to work best is simply open up terminal run pod update restart Xcode and every time it fixed the problem for me.
Firstly,when you are using Cocoapods to Develop iOS projects,you need to open the project with .xcodeworkspace file instead of .xcodeproj file.
Secondly you can Show Package Contents with .xcworkspace file,you will find the contents.xcworkspacedata file.
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:BluetoothColorLamp24G.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
pay attention to this line:
location = "group:BluetoothColorLamp24G.xcodeproj"
The .xcworkspace file has reference with the .xcodeproj file.
If you find there is no file or wrong path about the location,you can link to your .xcodeproj file,which works for me.
Development Environment:
macOS 10.14
Xcode 10.1
For me, I switched to a different Macbook. Running pod update fixed everything for me.
I will add to this answer::: From #Chris Miles.
Close Xcode and delete the folder <username>.xcuserdatad from within <projectname>.xcodeproj/xcuserdata/. Then restart Xcode, the schemes should re-appear.
Close Xcode, and everything, about ios development like simulators, then run again you pod install if you are using cocoa pods.
That's works for me.
This answer is for people who tried everything in the answers and still did not fix the issue:
Your solution is git checkout mainline. Because you probably played around with xcodeproj file and its broken now..
I have Removed pod completely from my project and adding it again.. retrieved my target and all
In my case the cause was renaming the project so I went to Manage Schemas and created the App Schema again (+ button).
In my case I missed }; in project.pbxproj after resolving conflicts
If you change the Major Name Change off/in your project in the past and after that deleted the Xcode and its data, You will see this issue. When You will clone this project on other device.You will see same issue.
To fix this, go to your pod file, update the target name and install the pods again.
None of the above worked for me. My solution was to look at the project file differences in text mode and I found that VALID_ARCHS got reset in two places (VALID_ARCHS = ""). Restoring the proper settings for VALID_ARCHS, also restored back the Schemes.
This commonly occurs when you install a Cocoapod, and try building and running from your workspace without first closing your project. If this is the case, quit Xcode, then open your app from your workspace and it should be fine.
In my case I rebranched to develop and then the window appeared if I want to resave my project. I must have clicked "close" though. Anyways, I lost my scheme and what helped was rebranching to some other branch, then back to develop and resave how I was supposed to do in the first place
Try this very simple steps:
Xcode menu "Product"
Scheme
Select another scheme

XCode 4 osx 10.9 - folding methods crashes

After updating to osx 10.9, in any of my projects doing the following crashes Xcode 4.6.3:
fold a method, if statement, for loop, etc
click on a different file
click back on the file with the folded code
When clicking back on the file I notice that all the line numbers are gone but the one at the very top (which is usually some random number and it sort of flashes a bit). Less than 5 seconds after clicking on this file XCode crashes.
This is repeatable. When I reopen Xcode and open the project, the problem persists. Now I am unable to access that file. I've tried closing Xcode and releasing the memory in RAM. I've tried removing the reference in the project and adding it back. Yes the problem persists.
This is massively frustrating and has completely derailed my development. Has anyone else had this issue? Anyone know how to solve it?
Here's the crash report if it's helpful.
-GW
Ok I figured it out, but am still curious as to why this is happening and how I can still fold my code without this problem.
click on the problem file.
click anywhere where the code should be (sometimes all the code appears to be gone)
goto Editor > Code Folding > Unfold All
That cleared it up.
It happened to me too. I fully share frustration and reasons why not going to rev 5.
Here's my solution :
exit xcode
go to your myProject.xcodeproj file
look inside the package for myProject.xcworkspace file (right click / Show Content)
back up myProject.xcworkspace outside your xcode hierarchy
delete myProject.xcworkspace file
restart xcode (a clean myProject.xcworkspace will be created).
NOTE: Works for me, but I'm not using workspaces. I have not tried, but I suppose that if you want to preserve your workspace settings you'd have to selectively delete the UserInterfaceState.xcuserstate files further down in the package hierarchy?
I had to delete UserInterfaceState.xcuserstate file to solve these reoccurring code/comments folding crashes in Xcode 4.6.3 running on OSX 10.9.
This file can be found at projName.xcodeproj(Show Package Contents)->project.xcworkspace(Show Package Contents)->xcuserdata->username.xcuserdatad->UserInterfaceState.xcuserstate
Note that you will loose all the saved user state info of your project, which means all your open tabs will disappear, folded code will be unfolded etc. And the crashes may start reoccuring if you fold any code or comment again.

Resources