2

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?

  • It's not reproducible with this code, it runs and archives too on Xcode 13.3 – RTXGamer Mar 19 '22 at 04:38
  • 1
    This might seem silly, but try removing the trailing comma in the gradient array. I had an issue earlier this week where something so simple was causing a segmentation error on archive only. Either thay, or you have another issue. Run the Xcodebuild archive command in terminal and it should give a better error/warning – valosip Mar 19 '22 at 04:39
  • 1
    It seems to be a problem with Xcode 13.3. I experience the same error but with a TwilioVoice package. – F.SO7 Mar 20 '22 at 10:30
  • @valosip I wasn't aware I could build in Terminal. I will give it a go. – JKDevAccount Mar 21 '22 at 21:46
  • @F.SO7 I'm glad I'm not the only one. Please let me know if you find any confirmation or solution to prevent it and I'll do the same. – JKDevAccount Mar 21 '22 at 21:47
  • @JKDevAccount I am having the same error with Xcode 13.3 with different Pods libraries. I decided to try reinstalling Xcode 13.2.1 for the moment – Rob B Apr 03 '22 at 16:08
  • Thanks for the heads up @RobB – did you find the 13.2.1 worked? That was going to be my course of action, too, but the download time was approaching 12hrs so I looked for other options. – JKDevAccount Apr 04 '22 at 17:26
  • @JKDevAccount In my case archive with 13.2.1 worked perfectly without changing app code, but this is a temporary workaround, it seems an issue in the 13.3 version with the most part of Pods Libraries – Rob B Apr 05 '22 at 19:32

0 Answers0