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.
I believe I may have found a more general purpose solution. Below are the steps I used to encourage Xcode not to produce the SourceKitService Terminated
error.
Error running playground: Failed prepare for communication with playground.
See this image on twitter.OS X
to iOS
, I would receive another error (unfortunately I did not write that one down).SourceKitService Terminated
issue in this thread.IDEPlaygroundDocument: Error encountered running playground
com.apple.CoreSimulator.CoreSimulatorService[3952]: The runtime for the selected device is not installed.
If you are only having an issue within the context of a Swift project, try this alone first. If that doesn't work, then try all of the steps further below.
The more lengthy and involved process. (The first 3 steps are not for sure helpful, but I did them, and so record them here)
OS X
to iOS
.It appears the issue is with Xcode6 not being able to properly find, and connect, to the simulator. I have not been able to determine why this is the case, but this has allowed me to continue developing with Swift. This may have to do with the fact the simulator binaries seem to have moved.
You just need to delete the "ModuleCache", this is some kind of cache used by Xcode for Autocompletion.
Copy and paste the following line in the Terminal:
rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache
SourceKitService crashes on my system as soon as I type
extension foo {
I'm using Xcode 6 beta 6 and it does not matter if I type it into an empty file or add it to an existing one. As soon as the source contains one extension
block, it will crash. This happens even on newly created projects.
My "solution" is to avoid extension in the sources I'm currently working on. I comment out the end of a class block and the beginning of the extension block. As soon as I have finished my work on the class, I comment them in again:
class MyClass {
[... my stuff ...]
//}
//
//extension MyClass {
}
It started happening on my spritekit project after inserting the touchesMoved-function. This function uses forced unwrapping, which seems to cause the problem:
override func touchesMoved(touches: NSSet!, withEvent event: UIEvent!)
After removing the exclamation marks and thus stopping forced unwrapping, the SourceKitService stopped crashing.
Hope this helps!
I found a solution on Apple's Developer Forums (which requires login, so I'll explain it here too).
TLDR: Don't import a @protocol
in your Objective-C to Swift bridging header that is named the same as an @interface
. For example, the Facebook SDK has both a protocol and an interface named "FBGraphObject".
Here's the forum post:
Adding Facebook SDK causes SourceKitService to crash. If you want to use beta 3 and you need Facebook SDK, one work around that I found and is working for me is refactoring Facebook SDK's @protocol FBGraphObject and renaming it to something like @protocol FBGraphObjectProtocol as an @interface FBGraphObject also exists and apparently SourceKit doesn't like it.
It sure is a temporary solution just to keep you functional and you'll have to use Cocoapods or otherwise build Facebook SDK yourself rather than using the framework library.
For the time being, you'll need to make sure you don't have conflicting @protocol and @interface declarations and that includes 3rd party libraries you may be using.
This cost me today, hope it helps!
Posted by e.parto on July 10, 2014
Use other name than Swift for the project. "Swift" is reserved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With