Xcode Source Kit will not stop crashing with Swift
You've probably tried all this, but just in case:
- close Xcode
- remove
'~/Library/Developer/Xcode/DerivedData/'
- remove
'~/Library/Caches/com.apple.dt.Xcode'
- restart your computer (just in case).
This should bring you code completion back, but the problem will eventually return. Xcode 6.1.1 beta (or now 6.2 beta with WatchKit) should fix many of the SourceKit related problems.
SourceKitService Terminated
The answer to mine (Xcode6-Beta7) was simply to delete the Derived Data folder.
Preferences > Locations > Derived Data > click the arrow to open in Finder > trash it.
Hope this helps someone. There's obviously many reasons why this crash can occur.
Swift SourceKitService Crashed
I would work on various projects and continually get this error, sometimes to the point where Xcode became unusable. I eventually solved the problem by quitting Xcode, emptying out the ~/Library/Developer/Xcode/DerivedData
folder, and then reopening the project.
Xcode Crashing When Opening Project File
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
andOpen 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 chooseShow 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).
Related Topics
Getting Wrong Date from Dateformat
Inserting Data into Realm Db with Progress
Ibeacon: Get Advertisement Package Faster
Problem Creating and Writing a Subdirectory in Swift 5
How to Handle Async Requests in Swift
How to Make Text Typed in Textfield Undeletable
How to Perform Conditional Segue
Dispatchworkitem Not Notifying Main Thread
Cicolorcontrols & Uislider W/ Swift 4
How to Conditionally Define a Podspec Property Depending on Static or Dynamic Usage
Xcode Swift 3: Timer and Segue View Controller Error
How to Get Video Duration Fro Avasset in Swift
How to Give Xib Cell Button Action in Homevc in Swift
Array Search Function Not Working in Swift
How to Simultaneously Satisfy Constraints Error Whats Causing This