Xcode 8 "Command Failure Due to Signal: Segmentation Error: 11"

I upgraded my Xcode to Xcode 8 and accepted all the updates, but I got the error message "Command failed due to signal: Segmentation fault: 11"

Notice that I know this question is very close to this:

Xcode 7 Compilation Error: "Command Error Due to Signal: Segmentation Error: 11"

Also note that I am using a parsing server, I doubt that it has anything to do with it, but I thought I mentioned it in case.

but he did not solve my problem, did anyone have this problem / solved it?

thanks!

+8
parsing xcode swift
source share
5 answers

We faced the same problem. This answer resolved our problem: Compiler segmentation error while creating

You need to expand all the options before you can use them in the if statement.

+3
source share

This is a dynamic issue with Xcode, but it can be solved by changing your own code. This happened to me when I migrated code from Swift2.3 to Swift3.1

In my case, an error was detected when defining a method, and the method is bound as @IBAction for UIButton.

 @IBAction func changeButtonTapped(_ sender: AnyObject) { // some code } 

Changing the above code to the following, I decided to solve the seg-fault problem.

 @IBAction func changeButtonTapped(_ sender: Any) { // some code } 

EDIT1: Another case of this segmentation error has appeared.

This time, this was due to overriding the variable in a higher scope and using the if statement in the same code example code:

 // 'var1' is defined in higher scope func someFunction() { if let var2 = var1, let var1 = someValue { // some code } } 

Xcode is confused as to which variable named "var1" to use to define var2. Changing names to something else will solve seg-fault.

+2
source share

Most likely, the reason is a coding error that Xcode did not take, because the built-in analysis crashed / did not speed up. Just restart Xcode to show you where the error is in your code.

0
source share

In my case, an error occurs with code like this:

 class AClass { var url: String? func aMethod() { guard let urlString = url, let url = URL(string: urlString) else { // Use `url` } } } 

Cause:

The fact that url is an optional var instance that I deploy to myself seems to break the Swift compiler.

Problem Finder:

What is interesting and can give you a hint about where the abusive code is located is that (at least in my case) the Xcode editor also crashes while writing the code:

enter image description here

Decision:

In my case, I just had to deploy an additional instance of var in another variable instead of myself (which was stupid in the first place ...). For example:.

 class AClass { var url: String? func aMethod() { guard let urlString = url, let actualUrl = URL(string: urlString) else { // Use `actualUrl` } } } 
0
source share

code with this error

 let fileManager = FileManager.default let fileAttributes = try! fileManager.attributesOfItem(atPath: OSWConfig.documentsPath.appendingPathComponent(folderName) as String) as NSDictionary //below code cause the error let createDate = fileAttributes.object(forKey: FileAttributeKey.creationDate)! as! NSDate 

Fix code without errors

 let keysList = fileAttributes.allKeys as! [FileAttributeKey] let valuesList = fileAttributes.allValues let indexCreateDate = keysList.index(of: FileAttributeKey.creationDate)! as Int var createDate: NSDate! if indexCreateDate >= 0 { createDate = valuesList[indexCreateDate] as! NSDate } 

This solved my problem.

-one
source share

All Articles