mginn
mginn

Reputation: 16124

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?

Upvotes: 2

Views: 3465

Answers (3)

Sujatha Girijala
Sujatha Girijala

Reputation: 1209

If you set value to the label instead of label.text

Upvotes: 0

Lukas
Lukas

Reputation: 3433

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 }

Upvotes: 2

mginn
mginn

Reputation: 16124

I figured it out. The problem was that there were several errors that the compiler was not catching. I got Xcode to find the errors by deleting a file, and then re-adding it. This showed thirty-something more errors that, when fixed, caused my code to compile completely.

Upvotes: 0

Related Questions