flynn
flynn

Reputation: 1584

Why is using join on array of strings causing Segmentation fault: 11 error on archiving in XCode?

I've been spending hours trying to ding why I keep getting the segmentation fault 11 error when archiving in XCode. I've figured out (by commenting out sections of code) that using:

// If I comment out the second line with join, the archive works
var test = ["hello","world"]
let tested = " ".join(test)

Any ideas as to why this is happening and how to fix it?

Upvotes: 4

Views: 95

Answers (1)

Matthew
Matthew

Reputation: 867

I encountered the very same issue. I think it is a bug in the compiler. The only workaround I found is to avoid to use join.

var array = ["hello", "world"]
var resultString = ""
for (index, string) in enumerate(array) {
    if index > 0 {
        resultString += " "
    }
    resultString += string
}

Upvotes: 0

Related Questions