4

We have faced the issue of "abort trap 6" in Xcode 12. Due to this reason app not running using Xcode 12. We are using the swift 5 versions and jsqmessageviewcontroller objective c library. Below errors getting in Xcode 12.

<unknown>:0: error: fatal error encountered while reading from module 'wwww'; please file a bug report with your project and the crash log
<unknown>:0: note: module 'wwww' full misc version is '5.3.2(5.3.2)/Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)'
top-level value not found
Cross-reference to module 'JSQMessagesViewController'
... JSQMessageMediaData
error: Abort trap: 6 (in target 'zapwww' from project 'zapwww')

If anyone has a solution please help us.

aheze
  • 24,434
  • 8
  • 68
  • 125
  • Maybe this is helpful: https://stackoverflow.com/questions/30724897/command-failed-due-to-signal-abort-trap-6 – koen Mar 28 '21 at 02:11

5 Answers5

9

I had the same error in Xcode 12.5.1 and it seems to be a bug that has been fixed in the next beta. However there seem to be several issues that could cause this error. So my solution might not work.

For me the problem was very specific and only happened in the following scenario:

  1. A method that returns an optional RealmObject (might be different in your case) is called.
  2. The returned RealmObject has been assigned a variable.
  3. Trying to unwrap the variable with guard let or if let using the same name for the new safely unwrapped variable.

The easiest fix is using different variable names or Safely unwrapping the returned object directly without assigning it a variable.

Example that causes the error in my case:

class MyClass {

    func returnObject() -> Object? {
        return nil
    }

    func anyMethod() {

        let myObject = returnObject()

        guard let myObject = myObject else { return } // <-- works anywhere else but here.

    }
}

Same example that fixed the error in my case:

class MyClass {

    func returnObject() -> Object? {
        return nil
    }

    func anyMethod() {

        let myObject = returnObject()

        guard let myNewObject = myObject else { return } // <-- Changed name of new variable here

    }
}

I've seen people had this issue with other types, so it's not limited to the RealmObject type. But going through all guard let or if let with the same variable name is a good start.

I've also seen other people use fix it by cleaning the build folder or removing packages and reinstalling them. That didn't help for me though.

Marco Boerner
  • 1,243
  • 1
  • 11
  • 34
  • Thanks, Xcode 12.5.1 was falling over for me in scenario (3) when building an AWS Lambda for the Swift runtime. This answer was a gem! – ncke Aug 23 '21 at 16:59
3

Problem: Abort Trap (In my case my code is working perfectly but when I trying to make an Archive file I got the "Abort Trap")

Solution:- Just Select Your Project from project Navegater (most Left Pane) Select Project > Select Targets > Build Settings > Swift Compiler - Code Genration > Optimization Level > Debug and Realease make "No Optimization [-Onone]"enter image description here

Muhammad Usman
  • 141
  • 1
  • 4
3

Flutter Specific

I had to set Optimization Level to No Optimization [-Onone] for Pods target.

Just Select Your Project from project Navigater (most Left Pane) Select Pods > Build Settings > Swift Compiler - Code Generation > Optimization Level > Debug and Realease make No Optimization [-Onone]

Rashesh Bosamiya
  • 609
  • 1
  • 9
  • 13
2

for me i have just remove the library which cause the problem from pods file , then installed again will fix the problem

Dark Knight
  • 370
  • 3
  • 13
0

just had to run: 'pod update' to update my Realm pods and fixed it for me.

jonathan3087
  • 313
  • 1
  • 4
  • 18