Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift SourceKitService Crashed

I have a Swift project using Core Data and the generated code for saveContext() is causing Xcode to crash with the SourceKitService Crashed error. When I comment it out the error stops, and it seems to be self.managedObjectContext which is causing the error. I have commented out my code so it is like a new project but its still crashing. Thanks

(Xcode 6.0.1)

func saveContext () {
    if let moc = self.managedObjectContext {
        var error: NSError? = nil
            if moc.hasChanges && !moc.save(&error) {
                // Replace this implementation with code to handle the error appropriately.
                // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
                NSLog("Unresolved error \(error), \(error!.userInfo)")
                abort()
        }
    }
}

I made a new project and copied my code across, and the new project is fine (and exactly the same) so I have reported this to apple as a potential bug.

Thanks

Update:

Found this to make things a little easier :)

https://github.com/kattrali/deriveddata-exterminator

like image 793
Dayn Goodbrand Avatar asked Oct 07 '14 07:10

Dayn Goodbrand


1 Answers

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.

like image 85
Scott K. Avatar answered Nov 14 '22 12:11

Scott K.