Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 291 Vote(s) - 3.52 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Command failed due to signal: Abort trap: 6

#1
Since Xcode 7 and Swift 2.0, I get the error above, like in the screenshot shown here:

![screenshot of error log][1]

I have no idea where this is coming from, cleaning and deleting derived data didn't work.

Anyone else experiencing this problem?

Project settings:

![project settings][2]

Target settings:

![target settings][3]


[1]:

[2]:

[3]:
Reply

#2
This is normally a Swift compiler bug, and if compiler is already latest-version, we can only workaround it, for example:

## Possible workarounds
### #1

Go to project Build ***`settings -> Swift Compiler - code generation -> Optimization Level`*** ***-> For both Debug & Release select option "Fast,Single-File Optimization[-O]***


[![settings][1]][1]

>Above forces compiler to operate a little differently, which seems to prevent crash.
>
>**Note** that both "`-O`" and "`-Osize`" may fix the crash, but I prefer `-O` to match release's settings, and avoid surprises in release.

## #2

Go to "`Build settings`", and set "`Compilation mode`" to "`Whole Module`" instead of "`Incremental`".
>By default for Debug it's `Incremental`, and for Release it's `Whole Module`.

## #3

Try latest Swift compiler, which is named "toolchain" and is downloadable at:

[To see links please register here]


>**WARNING:** You can not upload such "toolchain" build to App-store .
>
>But at least you should be able to test locally.
>
>For App-store, you need to compile with Swift compiler that comes with your `Xcode` (or latest Xcode, if your current Xcode version does not compile).

### #4
Last and least (don't do this);
edit entire project's and/or pods' source-codes, and ensure guards have separate name than what they guard.
For example, replace:
```
guard let myVariableName = myVariableName else { return }
```
With something like:
```
guard let myDifferentName = myVariableName else { return }
```
>Of course, now all lines after `guard` need to use `myDifferentName`.

[1]:
Reply

#3
My code was crashing because of nested function.
Example code is below :

Error :
```
extension UILabel {

var attributedTextTruncates: Bool {

guard numberOfLines > 0 else { return false }
return countLabelLines() > numberOfLines

func countLabelLines() -> Int {
guard let myText = attributedText else {return 0}

let labelSize = myText.boundingRect(with: CGSize(width: self.bounds.width, height: CGFloat.greatestFiniteMagnitude), options: NSStringDrawingOptions.usesLineFragmentOrigin, context: nil)
return Int(ceil(CGFloat(labelSize.height) / self.font.lineHeight))
}
}
}
```


Correct Code :

```
extension UILabel {

var attributedTextTruncates: Bool {
guard numberOfLines > 0 else { return false }
return countLabelLines() > numberOfLines
}

private func countLabelLines() -> Int {
guard let myText = attributedText else {return 0}
let labelSize = myText.boundingRect(with: CGSize(width: self.bounds.width, height: CGFloat.greatestFiniteMagnitude), options: NSStringDrawingOptions.usesLineFragmentOrigin, context: nil)
return Int(ceil(CGFloat(labelSize.height) / self.font.lineHeight))
}
}
```
Reply

#4
This worked for me, so just give it a try. i got this error while converting the code from swift 3 to swift 4.

Simply, go to Project>Target>Build Setting and search 'Swift Compiler - Code Generation' and set Optimization level to 'No Optimization[-Onone]'.


[1]:
Reply

#5

I made mistake of using similar constant "name" in guard statement, causing this error.

guard let model = DataModel(JSON: response),
let model = model.first else { return }

In above example, constant name "*model*" is used twice, use new constant name instead.

guard let parsedObj = DataModel(JSON: response),
let model = parsedObj.first else { return }

NOTE: Xcode compiler do not warn you on this in compilation.


Please also check this answer which help to identify cause of this error.

[To see links please register here]

Reply

#6
My problem was with the line:

return ()

i removed the line and problem fixed!
Reply

#7
I faced this issue when used the same constant names in a guard construction

let activityVC = ...

guard let activityVC = activityVC else { return }

But xcode didn't show me any warning for this row.
Reply

#8
in Xcode 11 and swift 5: Go to project Build settings -> Swift Compiler - code generation -> Optimization Level -> For both Debug & Release select option "No Optimaiztion[-Onone]


![enter image description here][1]


[1]:
Reply

#9
In my case the problem with "Abort trap: 6" was caused by setting a value of a @Published property defined in a super class, that inherits from ObservableObject (Swift 5).

Error:

class MySuperClass : ObservableObject {
@Published var myProperty : Int = 0
}

class MySubClass : MySuperClass {
func someFunc() {
myProperty = 1
}
}

Ok:

class MySuperClass : ObservableObject {
@Published var myProperty : Int = 0

func setMyProperty(value: Int) {
myProperty = value
}
}

class MySubClass : MySuperClass {
func someFunc() {
setMyProperty(value: 1)
}
}
Reply

#10
In my case search for

[String: String]

replace with

[String: Any]
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through