SourceKitService Terminated错误导致编译器错误

时间:2014-07-30 00:12:28

标签: swift xcode6 sourcekit

我正在使用Ray Wenderlich的故事板教程第1部分来学习如何使用故事板,我在Swift中这样做。所以我将从

传输以下代码,该代码位于AppDelegate.swift文件中
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UINavigationController *navigationController = [tabBarController viewControllers][0];
PlayersViewController *playersViewController = [navigationController viewControllers][0];
playersViewController.players = _players;

let tabBarController : UITabBarController = self.window?.rootViewController as UITabBarController
    let navBarController = tabBarController.viewControllers[0] as UINavigationController
    let playersController = navBarController.viewControllers[0]
    playersController.players = self.players

然而,后一部分代码会引发编译器错误,因为当我声明playersController时,我不会将navBarController.viewControllers [0]返回的AnyObject向下转换为我的自定义PlayersTableViewController类。所以我用以下代码

来做到这一点
let playersController = navBarController.viewControllers[0] as PlayersTableViewController

但这会导致出现SourceKitService Xcode 6错误,并且我将失去所有语法突出显示。

所以我要么继续没有语法高亮,要么不继续,因为playerController需要被识别为PlayersTableViewController才能访问player属性。我已经将其缩小到导致Xcode出错的那个向下倾斜操作,是否有人对此问题有任何解决方案?

编辑:我试图在没有语法着色的情况下继续,编写必要的代码,然后编译它,但它抛出了以下混乱的编译器错误。

0  swift                    0x0000000109fed688 llvm::sys::PrintStackTrace(__sFILE*) + 40
1  swift                    0x0000000109fedb74 SignalHandler(int) + 452
2  libsystem_platform.dylib 0x00007fff8f55b5aa _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1890208368
4  swift                    0x00000001094b8dab (anonymous namespace)::RValueEmitter::emitForceValue(swift::SILLocation, swift::Expr*, unsigned int, swift::Lowering::SGFContext) + 1291
5  swift                    0x00000001094ace5f swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 4111
6  swift                    0x00000001094b436d swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 45
7  swift                    0x00000001094cb903 swift::Lowering::SILGenFunction::emitRValueAsOrig(swift::Expr*, swift::Lowering::AbstractionPattern, swift::Lowering::TypeLowering const&, swift::Lowering::SGFContext) + 179
8  swift                    0x000000010949f496 (anonymous namespace)::CheckedCastEmitter::emitOperand(swift::Expr*) + 150
9  swift                    0x00000001094b6350 emitUnconditionalCheckedCast(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Expr*, swift::Type, swift::CheckedCastKind, swift::Lowering::SGFContext) + 288
10 swift                    0x00000001094ae40d swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 9661
11 swift                    0x000000010949caeb swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*) + 219
12 swift                    0x000000010949397e swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 190
13 swift                    0x00000001094cfd4c swift::Lowering::SILGenFunction::visitBraceStmt(swift::BraceStmt*) + 332
14 swift                    0x00000001094d2c54 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Stmt*) + 148
15 swift                    0x00000001094a0f93 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 243
16 swift                    0x0000000109482096 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 230
17 swift                    0x000000010949bd83 swift::ASTVisitor<SILGenType, void, void, void, void, void, void>::visit(swift::Decl*) + 355
18 swift                    0x000000010949a70b SILGenType::emitType() + 203
19 swift                    0x00000001094956de swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30
20 swift                    0x000000010948400b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 411
21 swift                    0x000000010948428c swift::SILModule::constructSIL(swift::Module*, swift::SourceFile*, unsigned int) + 268
22 swift                    0x0000000109484390 swift::performSILGeneration(swift::SourceFile&, unsigned int) + 32
23 swift                    0x00000001093751a7 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 3255
24 swift                    0x000000010937448d main + 1645
25 libdyld.dylib            0x00007fff9a2fd5fd start + 1
26 libdyld.dylib            0x0000000000000039 start + 1708141117
Stack dump:
0.  Program arguments: /Applications/Xcode6-Beta4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/Player.swift /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/ViewController.swift -primary-file /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/AppDelegate.swift /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/PlayersTableViewController.swift -enable-objc-attr-requires-objc-module -target i386-apple-ios7.1 -module-name Ratings -sdk /Applications/Xcode6-Beta4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -I /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Products/Debug-iphonesimulator -F /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Products/Debug-iphonesimulator -g -module-cache-path /Users/alex/Library/Developer/Xcode/DerivedData/ModuleCache -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Ratings-generated-files.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Ratings-own-target-headers.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Ratings-all-target-headers.hmap -Xcc -iquote -Xcc /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Ratings-project-headers.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Products/Debug-iphonesimulator/include -Xcc -I/Applications/Xcode6-Beta4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/DerivedSources/i386 -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/DerivedSources -Xcc -DDEBUG=1 -emit-module-doc-path /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate~partial.swiftdoc -O0 -emit-module-path /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate~partial.swiftmodule -serialize-diagnostics-path /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate.dia -emit-dependencies-path /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate.d -o /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate.o 
1.  While emitting SIL for 'application' at /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/AppDelegate.swift:18:5
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
Command /Applications/Xcode6-Beta4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254

0 个答案:

没有答案