milesper milesper - 1 year ago 117
iOS Question

Segmentation Fault 11 on upgrading to Swift 2.0

I have an iOS project that as of yesterday was working perfectly. Now I've updated to Xcode 7, bringing Swift 2.0 syntax. I went through and resolved all the errors as suggested to use new syntax. When I try to build, the build fails with a "Command failed due to signal: Segmentation fault: 11". This occurs on 4 different files.

The problem is, those four files didn't have any code that needed updating, and are quite simple files (on of them doesn't do anything but set a label to a property value). What gives?

Answer Source

I've noticed that simple typos could cause this, here is one

var myVar: Type = { return value }

The above is usually unidentified and even compiled sometimes but it also cause segmentation fault. simply removing the equal sign will fix it

var myVar: Type { return value }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download