Can't archive working 6.0.1 Swift project in X

2019-02-26 08:06发布

问题:

Command failed due to signal: Segmentation fault: 11 While type-checking expression at [/Users/thedude/Documents/Repositories/MyProject/Data.swift:258:36 - line:258:56] RangeText="UILocalNotification()"

The error is referring to the following line of code.

var notification = UILocalNotification()
// also tried var notification:UILocalNotification = UILocalNotification()

The problem only occurs when archiving (to submit to store). If I comment out that line of code the error will just appear in other random locations until I eventually have a project that is pretty useless.

This is another example of what appears after commenting out the previous code mentioned.

var someDate:NSDate = self.datePicker.date

And so on... The REALLY strange part is this project compiles and builds totally fine on the device. This only happens when building for ARCHIVE. I have set the Swift Compiler Optimization Level to None to see if that was the cause to no avail.

回答1:

Although it is not the solution I would hope for I did discover if I set the Swift Compiler Optimization Level to Fastest, Unchecked [-Ounchecked] I am able to at least archive and submit my build.

I am assuming this is an Xcode 6.1 (release) specific issue and have filed a bug report.



回答2:

Changing your Deployment Target to 8.1 fixes this for me. I haven't tested Archiving but works for the Simulator.



回答3:

I had the same issue on Xcode 6.1. Building and running the Swift project was no problem, archiving led to an error:

Command failed due to signal: Segmentation fault: 11
1.  While type-checking <my Swift class>

Changing the project's Deployment Target from 7.0 to 7.1 solved the problem, the app can now be archived.