0

The error pops up when I try to run the program but it is working fine if I comment out call to Utility.subscribeToServer function.

let targetURL = "\(BASE_URL)/users/\(self.userId)/subscribe"    
Utility.subscribeToServer(targetURL, deviceId, self.deviceType, completion: {(data, response, error) -> Void in
                print(data)
        })

Utility.subscribeToServer function

class func  subscribeToServer(targetURL : NSURL!, deviceId : NSData, deviceType : String, completion : (data : NSData?, response : NSHTTPURLResponse, error : NSError?) -> Void) {
        print("Performing POST request")
        let request = NSMutableURLRequest(URL: targetURL)
        request.HTTPMethod = "POST"
        let postBody = "deviceId=\(deviceId)&deviceType=\(deviceType)"
        request.HTTPBody = postBody.dataUsingEncoding(NSUTF8StringEncoding)
        let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
            data, response, error in
            dispatch_async(dispatch_get_main_queue(), {() -> Void in
                completion(data: data, response: response as! NSHTTPURLResponse, error: error)
            })
        }
        task.resume()
    }

Complete Error :

CompileSwift normal x86_64 /Users/dk/Desktop/IosApps/OT/OT/ViewController.swift
    cd /Users/dk/Desktop/IosApps/OT
    "/Applications/Xcode-beta 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift" -frontend -c /Users/dk/Desktop/IosApps/OT/OT/Utility.swift -primary-file /Users/dk/Desktop/IosApps/OT/OT/ViewController.swift /Users/dk/Desktop/IosApps/OT/OT/DashboardViewController.swift /Users/dk/Desktop/IosApps/OT/OT/AppDelegate.swift -target x86_64-apple-ios8.4 -enable-objc-interop -sdk "/Applications/Xcode-beta 2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk" -I /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Products/Debug-iphonesimulator -F /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Products/Debug-iphonesimulator -F /Users/dk/Downloads/FacebookSDKs -enable-testing -g -import-objc-header /Users/dk/Desktop/IosApps/OT/OT/bridging-header.h -module-cache-path /Users/dk/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/OT-generated-files.hmap -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/OT-own-target-headers.hmap -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/OT-all-target-headers.hmap -Xcc -iquote -Xcc /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/OT-project-headers.hmap -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/DerivedSources/x86_64 -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/dk/Desktop/IosApps/OT -emit-module-doc-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController~partial.swiftdoc -Onone -module-name OT -emit-module-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController.dia -emit-dependencies-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController.d -emit-reference-dependencies-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController.swiftdeps -o /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController.o

UnresolvedDotExpr should not survive to SILGen
UNREACHABLE executed at /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.52.2/src/swift/include/swift/AST/ExprNodes.def:78!
0  swift                    0x0000000111227bbb llvm::sys::PrintStackTrace(__sFILE*) + 43
1  swift                    0x00000001112282fb SignalHandler(int) + 379
2  libsystem_platform.dylib 0x00007fff8412ef1a _sigtramp + 26
3  swift                    0x000000011180dac6 FirstTarget + 63582
4  swift                    0x00000001112280f6 abort + 22
5  swift                    0x00000001111e1931 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 481
6  swift                    0x000000010f40d2bd swift::ASTVisitor<(anonymous namespace)::SILGenApply, void, void, void, void, void, void>::visit(swift::Expr*) + 6061
7  swift                    0x000000010f41162c (anonymous namespace)::SILGenApply::visitApplyExpr(swift::ApplyExpr*) + 4668
8  swift                    0x000000010f40218f prepareApplyExpr(swift::Lowering::SILGenFunction&, swift::Expr*) + 175
9  swift                    0x000000010f40209f swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 47
10 swift                    0x000000010f442e67 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 87
11 swift                    0x000000010f440a2d swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 445
12 swift                    0x000000010f48fbc8 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 536
13 swift                    0x000000010f48f9a5 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
14 swift                    0x000000010f456da6 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 390
15 swift                    0x000000010f3f4601 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 513
16 swift                    0x000000010f49587c (anonymous namespace)::SILGenType::emitType() + 1132
17 swift                    0x000000010f49536e swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30
18 swift                    0x000000010f3f860b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 587
19 swift                    0x000000010f3f94af swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 991
20 swift                    0x000000010f3f990b swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 123
21 swift                    0x000000010f1eb36e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 12622
22 swift                    0x000000010f1e7fc8 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2728
23 swift                    0x000000010f1e402f main + 2015
24 libdyld.dylib            0x00007fff8b8365c9 start + 1
25 libdyld.dylib            0x0000000000000041 start + 1954323065
Stack dump:
0.  Program arguments: /Applications/Xcode-beta 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/dk/Desktop/IosApps/OT/OT/Utility.swift -primary-file /Users/dk/Desktop/IosApps/OT/OT/ViewController.swift /Users/dk/Desktop/IosApps/OT/OT/DashboardViewController.swift /Users/dk/Desktop/IosApps/OT/OT/AppDelegate.swift -target x86_64-apple-ios8.4 -enable-objc-interop -sdk /Applications/Xcode-beta 2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -I /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Products/Debug-iphonesimulator -F /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Products/Debug-iphonesimulator -F /Users/dk/Downloads/FacebookSDKs -enable-testing -g -import-objc-header /Users/dk/Desktop/IosApps/OT/OT/bridging-header.h -module-cache-path /Users/dk/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/OT-generated-files.hmap -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/OT-own-target-headers.hmap -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/OT-all-target-headers.hmap -Xcc -iquote -Xcc /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/OT-project-headers.hmap -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/DerivedSources/x86_64 -Xcc -I/Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/dk/Desktop/IosApps/OT -emit-module-doc-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController~partial.swiftdoc -Onone -module-name OT -emit-module-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController.dia -emit-dependencies-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController.d -emit-reference-dependencies-path /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController.swiftdeps -o /Users/dk/Library/Developer/Xcode/DerivedData/OT-fhsbtmkxhluqjtbijrkoyskftnal/Build/Intermediates/OT.build/Debug-iphonesimulator/OT.build/Objects-normal/x86_64/ViewController.o 
1.  While emitting SIL for 'subscribeToServer' at /Users/dk/Desktop/IosApps/OT/OT/ViewController.swift:75:5

I'm not able to figure out the problem. My xcode is also having "source editor functionality is limited" error which started to come around same time as the above error.

I would really appreciate some help.

crysis
  • 1,514
  • 1
  • 20
  • 35
  • SIGILL (which has the value 4) is the signal being sent. That usually means something which is supposed to be function code is corrupt or you passed data somehow as code to execute. I would use the debugger to find the exact line which this happens at by adding a break point in `subscribeToServer` and stepping through the function.You will need a break point in the completion handlers as well as they will run later if it gets that far. Once you have the exact line, it might become more obvious. – Rory McKinnel Aug 24 '15 at 11:33
  • It is a compile time error. I've added the complete error. – crysis Aug 24 '15 at 11:43
  • Try deleting the Derived Data folder. See here: http://stackoverflow.com/questions/24006206/sourcekitservice-terminated This seems a common thing to try first for many issues with XCode. – Rory McKinnel Aug 24 '15 at 12:21
  • Re-install XCode might be next option then? Which version are you using. – Rory McKinnel Aug 24 '15 at 12:28
  • Nice of it to tell you given it knows it was expecting an NSURL! Anyway, glad you are sorted. – Rory McKinnel Aug 24 '15 at 12:38

0 Answers0