As you may well see from my account, I don't much post here, although StackOverflow is a non-stop resource for jumping the hurdles that coding throws my way. However, I have no idea what to make of this and wondered if any wise heads could advise.
I recently upgraded to Xcode 13.3, mainly because my own device's upgrade to the latest iOS (15.4) stopped my ability to build directly.
After several small feature introductions and bug fixes, and a decent amount of local testing, I finally went to distribute the latest and greatest code to TestFlight. Except when I went to archive the project that happily builds at all other times, I am faced with:
error: Segmentation fault: 11 (in target 'ProjectName' from project 'ProjectName')
I try to run it on my device directly... no problems. So I try a Clean Build Folder, then try to archive it again. Same error. And so it goes on for a good while.
I even checked out the old commit for the version that is already on TestFlight - error: Segmentation fault: 11. Xcode 13.2.1 archived that code without issue but 13.3 won't?!
Anyway, I finally isolate the problem to a view and then begin the process of elimination by commenting out chunks and re-archiving. After enough trial and error, I find the problem:
let backgroundGradient = LinearGradient(gradient: Gradient(stops: [
Gradient.Stop(color: .black.opacity(0.0), location: 0.7),
Gradient.Stop(color: .black.opacity(0.6), location: 1),]), startPoint: .top, endPoint: .bottom)
which later is used here:
VStack(alignment: .leading) {
Spacer()
HStack(alignment: .bottom) {
Text("Hey StackOverflow!")
.foregroundColor(.white)
.multilineTextAlignment(.leading)
.frame(alignment: .leading)
Spacer()
}
.padding([.leading, .bottom])
}.background(backgroundGradient)
.cornerRadius(16.0)
.frame(height: 200)
.padding(.horizontal)
If I remove the backgroundGradient from the view and comment out the declaration, the archiving works. If I put it back in – it doesn't.
And the real kicker? I use the same backgroundGradient code elsewhere on other views which remain in the project and the archiving is fine.
What could I be missing here?