Xcode 7:由于信号命令失败:非法指令4

时间:2015-08-24 11:06:11

标签: ios xcode swift

当我尝试运行程序时会弹出错误但如果我注释掉对Utility.subscribeToServer函数的调用它会正常工作。

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

Utility.subscribeToServer功能

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()
    }

完成错误:

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

我无法弄清楚问题所在。我的xcode也有“源编辑器功能有限”错误,该错误与上述错误同时发生。

我真的很感激一些帮助。

0 个答案:

没有答案