신호로 인해 명령이 실패했습니다 : 분할 오류 : 11
오류가 발생합니다 ...
신호로 인해 명령이 실패했습니다 : 분할 오류 : 11
... 내 스위프트 앱을 컴파일하려고 할 때. Xcode 6.1을 사용하고 있으며 iOS 8.1에서 iPhone 5를 빌드하려고합니다.
내 코드
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var username: UITextField!
@IBAction func signIn(sender: AnyObject) {
PFUser.logInWithUsernameInBackground(username.text, password:"mypass") {
(user: PFUser!, error: NSError!) -> Void in
if user != nil {
println("Logged In")
} else {
func myMethod() {
var user = PFUser()
user.username = username.text
user.password = " "
user.signUpInBackgroundWithBlock {
(succeeded: Bool!, error: NSError!) -> Void in
if error == nil {
// Hooray! Let them use the app now.
} else {
println("Signed Up")
}
}
}
println(error)
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
Parse.setApplicationId("key here")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
그리고 오류 텍스트!
CompileSwift normal arm64 /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/ViewController.swift
cd /Users/Alec/Desktop/Re-Chat/Re-Chat
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/ViewController.swift /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/AppDelegate.swift -target arm64-apple-ios8.0 -Xllvm -aarch64-use-tbi -target-cpu cyclone -target-abi darwinpcs -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -I /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Products/Debug-iphoneos -F /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Products/Debug-iphoneos -F /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat -g -import-objc-header /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/Re-Chat-Bridging-Header.h -module-cache-path /Users/Alec/Library/Developer/Xcode/DerivedData/ModuleCache -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Re-Chat-generated-files.hmap -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Re-Chat-own-target-headers.hmap -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Re-Chat-all-target-headers.hmap -Xcc -iquote -Xcc /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Re-Chat-project-headers.hmap -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Products/Debug-iphoneos/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/DerivedSources/arm64 -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/DerivedSources -Xcc -DDEBUG=1 -emit-module-doc-path /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController~partial.swiftdoc -Onone -module-name Re_Chat -emit-module-path /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController.dia -emit-dependencies-path /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController.d -o /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController.o
0 swift 0x0000000108145a68 llvm::sys::PrintStackTrace(__sFILE*) + 40
1 swift 0x0000000108145f54 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff86631f1a _sigtramp + 26
3 libsystem_platform.dylib 0x00007fd0ac1eb010 _sigtramp + 633049360
4 swift 0x00000001075d4517 swift::Lowering::SILGenFunction::emitClosureValue(swift::SILLocation, swift::SILDeclRef, llvm::ArrayRef<swift::Substitution>, swift::AnyFunctionRef) + 1303
5 swift 0x00000001075c599e swift::Lowering::SILGenFunction::visitFuncDecl(swift::FuncDecl*) + 190
6 swift 0x000000010760987c swift::Lowering::SILGenFunction::visitBraceStmt(swift::BraceStmt*) + 380
7 swift 0x000000010760c8e8 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Stmt*) + 152
8 swift 0x000000010760a0a5 swift::Lowering::SILGenFunction::visitIfStmt(swift::IfStmt*) + 757
9 swift 0x000000010760c8f6 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Stmt*) + 166
10 swift 0x00000001076097e8 swift::Lowering::SILGenFunction::visitBraceStmt(swift::BraceStmt*) + 232
11 swift 0x000000010760c8e8 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Stmt*) + 152
12 swift 0x00000001075d52dd swift::Lowering::SILGenFunction::emitClosure(swift::AbstractClosureExpr*) + 205
13 swift 0x00000001075b4234 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*) + 196
14 swift 0x00000001075eef71 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 97
15 swift 0x00000001075e1866 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 2870
16 swift 0x00000001075e24da swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 6058
17 swift 0x00000001075cfa0b swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*) + 235
18 swift 0x00000001075ae824 swift::Lowering::RValueSource::materialize(swift::Lowering::SILGenFunction&) && + 196
19 swift 0x0000000107604a69 swift::Lowering::RValueSource::materialize(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::SILType) && + 233
20 swift 0x00000001075f371c swift::Lowering::SILGenFunction::emitInjectOptionalValueInto(swift::SILLocation, swift::Lowering::RValueSource&&, swift::SILValue, swift::Lowering::TypeLowering const&) + 268
21 swift 0x00000001075e9b8d swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 36445
22 swift 0x00000001075e3e2b swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 12539
23 swift 0x00000001075e202b swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 4859
24 swift 0x00000001075cfab6 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) + 22
25 swift 0x00000001075bffc4 (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::RValueSource&&, swift::Lowering::AbstractionPattern) + 836
26 swift 0x00000001075bf582 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::RValueSource&&, swift::Lowering::AbstractionPattern) + 98
27 swift 0x00000001075b7ff8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 1128
28 swift 0x00000001075b751a swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 58
29 swift 0x00000001075e0d81 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 81
30 swift 0x00000001075ea00d swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 237
31 swift 0x0000000107609829 swift::Lowering::SILGenFunction::visitBraceStmt(swift::BraceStmt*) + 297
32 swift 0x000000010760c8e8 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Stmt*) + 152
33 swift 0x00000001075d4ee0 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 256
34 swift 0x00000001075b3659 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 233
35 swift 0x00000001075cea93 swift::ASTVisitor<SILGenType, void, void, void, void, void, void>::visit(swift::Decl*) + 355
36 swift 0x00000001075cd7eb SILGenType::emitType() + 203
37 swift 0x00000001075c85ae swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30
38 swift 0x00000001075b555b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 395
39 swift 0x00000001075b581a swift::SILModule::constructSIL(swift::Module*, swift::SourceFile*, swift::Optional<unsigned int>) + 314
40 swift 0x00000001075b5968 swift::performSILGeneration(swift::SourceFile&, swift::Optional<unsigned int>) + 72
41 swift 0x000000010748be18 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 3432
42 swift 0x000000010748996d main + 1677
43 libdyld.dylib 0x00007fff8aa4c5c9 start + 1
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/ViewController.swift /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/AppDelegate.swift -target arm64-apple-ios8.0 -Xllvm -aarch64-use-tbi -target-cpu cyclone -target-abi darwinpcs -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -I /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Products/Debug-iphoneos -F /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Products/Debug-iphoneos -F /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat -g -import-objc-header /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/Re-Chat-Bridging-Header.h -module-cache-path /Users/Alec/Library/Developer/Xcode/DerivedData/ModuleCache -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Re-Chat-generated-files.hmap -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Re-Chat-own-target-headers.hmap -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Re-Chat-all-target-headers.hmap -Xcc -iquote -Xcc /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Re-Chat-project-headers.hmap -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Products/Debug-iphoneos/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/DerivedSources/arm64 -Xcc -I/Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/DerivedSources -Xcc -DDEBUG=1 -emit-module-doc-path /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController~partial.swiftdoc -Onone -module-name Re_Chat -emit-module-path /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController.dia -emit-dependencies-path /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController.d -o /Users/Alec/Library/Developer/Xcode/DerivedData/Re-Chat-awwdkmqavitiqkcdsphwnhzhzzfb/Build/Intermediates/Re-Chat.build/Debug-iphoneos/Re-Chat.build/Objects-normal/arm64/ViewController.o
1. While emitting SIL for 'signIn' at /Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/ViewController.swift:14:15
2. While silgen closureexpr SIL function @_TFFC7Re_Chat14ViewController6signInFS0_FPSs9AnyObject_T_U_FTGSQCSo6PFUser_GSQCSo7NSError__T_ for expression at [/Users/Alec/Desktop/Re-Chat/Re-Chat/Re-Chat/ViewController.swift:16:80 - line:45:9] RangeText="{
(user: PFUser!, error: NSError!) -> Void in
if user != nil {
// Do stuff after successful login.
println("Logged In")
} else {
func myMethod() {
var user = PFUser()
user.username = username.text
user.password = ""
// other fields can be set just like with PFObject
user.signUpInBackgroundWithBlock {
(succeeded: Bool!, error: NSError!) -> Void in
if error == nil {
// Hooray! Let them use the app now.
} else {
println("Signed Up")
}
}
}
println("error")
}
}"
다른 사람 이이 문제를 겪고 있다면 ...이 문제는 사용자 지정 프레임 워크를 가져 와서 발생한다는 것을 알았습니다. 어떻게 수정 해야할지 모르겠습니다. 그러나 프레임 워크에서 가져 오기 및 코드 참조 항목을 제거하면 문제가 해결됩니다.
(╯ ° □ °) ╯︵ ┻━┻
이것이 어떤 라인이 문제를 일으키는 지 추적하는 데 몇 시간을 절약 할 수 있기를 바랍니다.
컴파일러가 코드에서 무슨 일이 일어나고 있는지 혼동되면이 오류가 발생할 수 있습니다. 함수에 중첩 된 함수로 보이는 것이 많이 있습니다. 한 번에 그 중 일부를 주석 처리하여 오류가 사라지는 지 확인할 수 있습니다. 그렇게하면 문제 영역에 집중할 수 있습니다. 런타임 오류가 아니라 컴파일 시간 오류이므로 중단 점을 사용할 수 없습니다.
나는 최근에 같은 문제에 직면했으며, 많은 답변이 모두에게 도움이되도록 구체적으로 답변했기 때문에 어떻게 해결했는지 일반화하려고합니다.
1. 먼저 오류 메시지의 맨 아래를보고 세그먼테이션 오류의 원인이되는 파일 및 기능을 식별하십시오.
2. 그런 다음 해당 기능을보고 모든 기능을 주석 처리했습니다. 나는 컴파일했고 이제는 효과가 있었다. 그런 다음 오류를 일으킨 줄에 부딪 칠 때까지 함수의 일부에서 주석을 제거했습니다. 이 후 나는 그것을 고칠 수 있었고, 그것은 모두 작동합니다. :)
나에게 이것은 Swift 2.0 의 Parse SDK 구문 이 변경 되었기 때문 입니다. 구문 분석을 사용 중이고 Swift 2.0으로 업그레이드하면 다음 구문이 변경됩니다.
스위프트 1.2 :
myPFQuery.findObjectsInBackgroundWithBlock({ (queryResults: [AnyObject]?, error: NSError?) -> Void in
// CODE
})
스위프트 2.0 :
myPFQuery.findObjectsInBackgroundWithBlock { (queryResults: [PFObject]?, error: NSError?) -> Void in
// CODE
}
첫 번째 '('와 마지막 ')'를 제거하면 가장 큰 문제가 발생했습니다. 이것을 찾기 위해 AGES를 가져 왔습니다!
이 오류가 발생했습니다. 약간의 좌절 후 Xcode clean을 시도하고 모든 것이 다시 작동하기 시작했습니다. 나중에 참조 할 수 있도록 여기에 그대로 두십시오.
이 오류가 Swift에서 Swift 2.0으로 변환되면 문제가있는 특정 파일 (blahClass.swift)을 명확하게 표시하고 오류 메시지 텍스트의 모든 경고 및 오류를 간략하게 설명합니다. 나는 이것을 수동으로 해결하고 이제는 앱이 잘 컴파일됩니다.
object.doubleValue = dict["doublevalue"] as! Int
내가 만든 각 단계를 롤백 한 후 이유를 찾았습니다.
나에게 이것은 내 코드 중 일부로 인해 발생했습니다. XCode의 자세한 컴파일러 출력은 실제로 충돌이 발생한 방법을 정확하게 지적했습니다.
그런 다음 메서드의 모든 코드를 주석 처리하고 nil을 반환하고 컴파일했습니다. 그런 다음 다양하고 훨씬 간단한 코드를 사용하여 메서드를 다시 구현했으며 작동했습니다.
Apple에 버그 보고서를 제출했습니다. 이것은 XCode 7 / Swift 2.0에서 충돌을 일으킨 다소 미친듯한 코드입니다.
func numberAndTitleFromDirectoryName(dirName: String) -> (Int, String)? {
let components = dirName.characters.split(maxSplit: 1, allowEmptySlices: false) { $0 == " " }.map { String($0) }.map { String($0) }
if let number = components.first?.toInt() {
if let title = components.last {
return (number, title)
}
}
return nil;
}
지도 기능을 사용하여 약간 흥분한 것 같습니다. 새 버전은 훨씬 간단하고 인간이 이해할 수 있습니다. 여전히 컴파일러는 충돌하지 않아야합니다. 최악의 경우 몇 가지 오류가 표시됩니다. Swift 1.x에서 작동하는 코드
Xcode 7.3 및 iOS 9.3과 비슷한 문제가있었습니다. Command failed due to signal: Segmentation fault: 11
정리 (cmd + shift + k) 코드, 파생 데이터 삭제 및 Xcode 종료와 같은 기본 단계가 작동하지 않았습니다.
내 코드에 범인이있었습니다.
그것은이었다 [txtUserName.text.characters.count = 0]
귀하의 경우 코드를 검토하고 범인을 수정하십시오.
그중 하나는 이름과 같은 getter 변수의 datatype이라는 이름입니다. 예를 들면 다음과 같습니다.
var someInstance: someInstance {...
업데이트 # 1. Int가 아닌 _a 변수 에주의를 기울이고 올바른 반환 유형을 가리키는 것을 잊어 버립니다. 피연산자 피연산자가 두 개 이상인 경우 문제가 발생합니다.
function getInt(value: Int) -> Int {
return _a? ?? _b?.count ?? 0
}
자식을 사용하면 쉽게 고칠 수 있습니다.
1) 터미널에서 :
git stash
2) 세그먼트 오류가 사라집니다.
3) 앱을 실행하십시오.
4) 터미널에서 :
git stash pop
5) Xcode는 이제 실제 문제를 알려줍니다.
충돌은 컴파일러 버그입니다 (코드가 유효한지 여부). 최신 베타 버전을 사용 해보고 여전히 충돌이 발생하면 bugs.swift.org에 버그 보고서를 제출하십시오 . Swift 팀은 이에 매우 민감합니다.
다음과 같이 하여이 오류를 제거했습니다.
"Link Binary With Libraries"에 많은 프레임 워크가 추가되었고 브리징 헤더도 사용하고있었습니다.
모든 프레임 워크를 다시 추가하고 브리징 헤더를 다시 추가했습니다. 이것은 내 문제를 해결했습니다.
Xcode 8.3 / Swift 3을 사용하고 있습니다.
@Ron B.의 답변을 사용하여 모든 코드를 살펴보고 성공적으로 빌드 될 때까지 다른 기능을 주석 처리했습니다. 그것은 async trailing closures
내 오류를 일으키는 것으로 밝혀졌습니다 .
후행 마감 :
let firstTask = DispatchWorkItem{
//self.doSomthing()
}
let secondTask = DispatchWorkItem{
//self.doSomthingElse()
}
//trailing closure #1
DispatchQueue.main.asyncAfter(deadline: .now() + 10){firstTask}
//trailing closure #2
DispatchQueue.main.asyncAfter(deadline: .now() + 20){secondTask}
나는 자동 완성이 구문을 사용하면Segmentation fault: 11
했다 사라지다
//autocomplete syntax closure #1
DispatchQueue.main.asyncAfter(deadline: .now() + 10, execute: firstTask)
//autocomplete syntax closure #2
DispatchQueue.main.asyncAfter(deadline: .now() + 20, execute: secondTask)
내가 스위치를 시도 그래서 나는 같은 문제가? 최적화 레벨로 빠른, 단일 파일 최적화 [-O]를 대신 빠른, 전체 모듈 최적화 후 내장, 일, 성공 앱 스토어에 보관.
우리가 사용한 일부 프레임 워크는 빠른 전체 모듈 최적화 수준 에 맞게 리팩토링해야합니다 . 그러나 나는 여전히 그 프레임 워크를 찾지 못했습니다.
릴리스 체계를 구축하려고 할 때 해당 코드 11이있었습니다. 내부 에이 코드 조각이있는 하나의 viewcontroller 클래스 (빠른)를 지적했습니다.
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
stuff...
}
문제는 슈퍼 클래스를 추가했을 때 init도 구현하는 것을 잊었다는 것입니다. super.init로 인해 컴파일러 오류가 발생했습니다. 분할 오류 : 11 따라서 이러한 문제가 발생하면 수퍼 클래스도 확인하는 것이 좋습니다.
나 자신이 만든 프레임 워크를 가져올 때 Segmentation Fault 11이 발생했습니다 (예, 정말 바보 같았습니다).
몇 달 동안 프레임 워크를 개발하고이를 Obj-C와 Swift가 혼합 된 주요 프로젝트에 통합 한 후 Obj-C로 가져 오는 것은 문제가되지 않았지만 import MySwiftProject
Swift에서 글 을 쓰 자마자 모든 문제가 해결되었습니다 .
간단히 말해서, 문제는 NSNotifications
클로저 사용에 대한 유형화를 제공하는 몇 가지 사용자 정의 메소드를 작성했다는 것입니다 .
func post(a : Int, b : String)
{
NSNotificationCenter.defaultCenter().postNotification("notification", object: nil, userInfo: ["a" : a, "b" : b])
}
func observe(block : (a : Int, b : String) -> ()) -> NSObjectProtocol
{
return NSNotificationCenter.defaultCenter().addObserverForName("notification", object: nil, queue: nil)
{
(n : NSNotification!) -> () in
// Unwrap the notification payload and provide types
if let a = n.userInfo?["a"] as? Int, let b = n.userInfo?["b"] as? String
{
block(a, b)
}
}
}
(실제로 위의 코드는 템플릿으로 수행했지만 다른 이야기입니다)
주범? 이:
func ... -> NSObjectProtocol
분명히, 애플은 메소드 NSObjectProtocol
선언에 사용할 수 NSNotification
있지만, 그렇게 할 때 Segfault 11
. 충돌 NSObjectProtocol
을 AnyObject
해결 하기 위해 교체 .
불행히도 segfault 11은 단순한 컴파일러 충돌이므로 문제를 해결하지 못할 수도 있지만 해결을위한 조치를 취할 수 있습니다. 약 2 시간이 걸렸지 만 이것이 내가 한 일입니다.
- 가지고있는 구조를 복제하여 새 프로젝트를 만듭니다. 필자의 경우 단일 뷰 컨트롤러 신속한 프로젝트를 만들고 다른 프로젝트로 신속한 프레임 워크를 추가했습니다.
- 모든 원본 코드를 서로 복사하십시오.
- 컴파일 단계로 이동하여 컴파일 할 파일을 제거하고 NSNotification typification과 같이 매우 신속한 해킹 코드를 비활성화하십시오.
- 변경을 수행 할 때마다 정리 ( ⌘⌥ ⇧ + K), 빌드 ( ⌘+ B) 및 오류를 수정하십시오.
- 세그먼테이션 결함이 사라질 때까지 3부터 반복하십시오.
필자의 경우 그 이유는 확장 내의 다른 클래스 내에 클래스가 선언되어 있기 때문입니다.
extension classOrig {
class classChild {
class classGrandChild {
static let aVariable : String = "SomeValue";
}
}
}
이것은 내 편에서 오류를 생성했습니다. 내 프로젝트에는 여러 프레임 워크가 있었지만 이전에는 발생하지 않았습니다.
나는 또한 이것을 잠시 동안 고투했다. Xcode 7.2를 사용하여 코드를 Swift 2로 업그레이드했으며 문제는 다음과 같습니다.
self.mainScrollView.documentView!.subviews.reverse() as! [MainSubView]
내가 바꾸어야했던 것 :
(self.mainScrollView.documentView!.subviews as! [MainSubView]).reverse()
하위 클래스에서 속성을 재정의 할 때이 오류가 발생했으며 속성 선언을 정확하게 반복하지 않았습니다.
Base class:
var foo: String! {return nil}
Subclass:
override var foo: String {return "bar"} // missing the implicit unwrap operator
For me it's because I have two bundles with the same name.
Read the debug message carefully.
in my case, I encountered this error because I used a single '=' instead of double '=' by mistake in if-statement.
if aString.characters.count = 2 {...}
None of these answers worked for me but I found my issue. It had to do with Error Handling (in the Disabling Error Propagation section). I had this method:
func getSlider() throws -> UISlider {
... // code that could throw an error
return UISlider()
}
Referencing it like this:
func anotherMethod() -> Float {
return try! getSlider().value
}
gave the error. But, when switching to this, it went away:
func anotherMethod() -> Float {
return (try! getSlider()).value
}
I also ran into this problem.... obviously, it is a general error or sorts... when the xcode gets confused.... in my case, I had 3 vars that I was assigning values to from an array.... but I did not specify the type of data in each element of the array.... once I did, it resolved the problem....
In my case I had declared the following property in one of my ViewControllers subclass:
@property NSString * title
I think this was conflicting with the already existing title
property in ViewController
. I renamed this property to something else and refactored its use and the error disappeared.
In my case it was caused by trying to use a function that returned an NSNumber as an argument where a Double was expected. My advice is be careful mixing Objective C objects with Swift datatypes. And as many others have suggested, comment out lines until you pinpoint which one causes the error. (Even if you create other errors when doing so, you can just ignore them and see what makes the segmentation fault error go away.)
For me I was blocking the main thread.
What I did to Fix it with GCD (see below)
dispatch_async(dispatch_get_main_queue(),
})
Human Error report:
In my case, the culprit was passing in an array in the place of a variadic parameter. That is, for the signature:
// Note the variadic parameter
func addSubview(subview subview: UIView, constrain: NSLayoutAttribute...)
I passed in:
// Compile-time error, "constrain" parameters have array brackets
someUIView.addSubview(subview: someOtherView, constrain: [.Leading, .Top, .Bottom, .Trailing])
rather than:
// Correct
someUIView.addSubview(subview: someOtherView, constrain: .Leading, .Top, .Bottom, .Trailing)
I got segmentation fault on my Mac Mini using Xcode Bots. The seg fault did only occur during build step of testing and not during building or running locally. Only in Xcode bots during build step of testing.
I am using macOS Sierra and Xcode 8, with the code converted to Swift 2.3.
I finally found the line causing the seg fault, it was caused by:
public let isIpad = UIDevice.currentDevice().userInterfaceIdiom == .Pad
Which was declared outside a class as a constant. Changing it to check the userInterfaceIdiom at runtime fixed the issue.
Hopes this helps someone else!
This is the error log for my seg fault:
0 swift 0x000000010f93d76b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1 swift 0x000000010f93ca56 llvm::sys::RunSignalHandlers() + 70
2 swift 0x000000010f93ddbf SignalHandler(int) + 287
3 libsystem_platform.dylib 0x00007fffb24aabba _sigtramp + 26
4 libsystem_platform.dylib 0x00007fbbfff49ae0 _sigtramp + 1302982464
5 swift 0x000000010db79996 (anonymous namespace)::Traversal::visit(swift::Expr*) + 118
6 swift 0x000000010db7b880 (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 128
7 swift 0x000000010db799eb (anonymous namespace)::Traversal::visit(swift::Expr*) + 203
8 swift 0x000000010db78f45 swift::Expr::walk(swift::ASTWalker&) + 53
9 swift 0x000000010d6d2c87 walkForProfiling(swift::AbstractFunctionDecl*, swift::ASTWalker&) + 231
10 swift 0x000000010d6d2719 swift::Lowering::SILGenProfiling::assignRegionCounters(swift::AbstractFunctionDecl*) + 553
11 swift 0x000000010d6de348 (anonymous namespace)::SILGenType::emitType() + 952
12 swift 0x000000010d6ddf1e swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30
13 swift 0x000000010d6625eb swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 731
14 swift 0x000000010d663139 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 793
15 swift 0x000000010d6635a3 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 115
16 swift 0x000000010d491c18 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 12536
17 swift 0x000000010d48dc79 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2777
18 swift 0x000000010d489765 main + 1957
19 libdyld.dylib 0x00007fffb229e255 start + 1
When your development target is not supporting any UIControl
내 경우 StackView
에는 개발 대상이있는 프로젝트에서 사용 하고 있었습니다 8.0
. 개발 대상이 UIControl을 지원하지 않는 경우이 오류가 발생할 수 있습니다.
잘못된 대상을 설정하면
아래 줄에서 self 대신 기본 대상 "target"을 그대로두면 세그먼트 오류 11이 발생합니다.
shareBtn.addTarget(self, action: #selector(ViewController.share(_:)), for: .touchUpInside)
참고 URL : https://stackoverflow.com/questions/26557581/command-failed-due-to-signal-segmentation-fault-11
'IT' 카테고리의 다른 글
Android의 로그에 출력을 작성하는 방법 (0) | 2020.06.15 |
---|---|
Java 날짜 및 시간 클래스를 사용해야합니까 아니면 Joda Time과 같은 타사 라이브러리를 사용해야합니까? (0) | 2020.06.15 |
SHA-1은 암호 저장에 안전합니까? (0) | 2020.06.15 |
memcpy () vs memmove () (0) | 2020.06.15 |
특정 https 원격에 대한 특정 자체 서명 서버 인증서를 수락하도록 Git 구성 (0) | 2020.06.15 |