Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


SIGABRT error ! Help

In the swift lesson, when I try to change the color of the button in the FunFactApp, I get a SIGABRT error =/ it won't work in anyways...

@IBAction func PushMe(sender: AnyObject) { var randomColor = colorWheel.randomColor() view.backgroundColor = randomColor funFactButton.tintColor = colorWheel.randomColor() TexteChange.text = factBook.randomFact()


8 Answers

Yup, here it is :

2015-06-05 11:08:39.511 FunFact[24180:2334236] Unknown class ViewController in Interface Builder file. 2015-06-05 11:08:39.515 FunFact[24180:2334236] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x7fd9f0d2ced0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key PushMe.'

Martin Wildfeuer
Martin Wildfeuer
Courses Plus Student 11,071 Points

Unknown class ViewController in Interface Builder file

Have you renamed your ViewController recently? It seems to me that the InterfaceBuilder still references a class that does not exist anymore. Let's try this:

  • Select your storyboard
  • Select the ViewController that contains your button by clicking the orange button above the view, on the left hand side
  • Make sure your Utility view (the column on the right) is open in Xcode.
  • Select the identity inspector (third icon from left)
  • See if at Custom Class -> Class the name matches that of your class. If not, select it from the dropdown.

Does that help?

P.S. Make sure to never begin a function name with an uppercase letter, like PushMe! That is exclusively reserved for classes, structs and enums.

Thanks ! But no, I've just checked and it matches the ViewController class... The problem only occurs when I had an outlet UIButton to the Viewcontroller class and then try to change its color in the func with the tint color property...

Martin Wildfeuer
Martin Wildfeuer
Courses Plus Student 11,071 Points

Hm, ok, so are your button action and outlet wired up correctly?

Select your button and select the Connections Inspector (last icon on the right) in the utility view. Make sure that it only contains the action and outlet that are supposed to be there. If not, remove the connection by clicking the small x.

Did that a hundred times, still not working... plus now even when I try to run the app without the outlet, app crashes and I get the SIGABRT alert that drives me to the AppDelegate class =/

Here is the full code from the ViewController class :

class ViewController: UIViewController {

@IBOutlet weak var texteChange: UILabel!

let factBook = FactBook()
let colorWheel = ColorWheel()

override func viewDidLoad() {
   texteChange.text = factBook.randomFact()
    /* On le copie ici car on veut que ça charge déjà un fait à l'ouverture de l'app */

    // Do any additional setup after loading the view, typically from a nib.

override func didReceiveMemoryWarning() {
    // Dispose of any resources that can be recreated.

@IBAction func pushMe(sender: AnyObject) {

    var randomColor = colorWheel.randomColor()
    view.backgroundColor = randomColor

    texteChange.text = factBook.randomFact()



And it keeps crashing...

Martin Wildfeuer
Martin Wildfeuer
Courses Plus Student 11,071 Points

Ok, the code seems ok to me, so it really seems that something is wrong with the project. Another thing you could check is if the ViewController.swift file is compiled at project build.

Click on Target > Build Phases > Compile Sources

(You can find the target when clicking on the project name in your navigator in the left column)

Is ViewController.swift in the list? If not, add it.

If that's not it, you might try to assign your custom view controller class again in InterfaceBuilder, maybe even write something into Model and remove it again. (See my first answer for how to navigate there)

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

With that error there won't be anything wrong with the code, it's probably a break point. in the gutter to the left side of the code look for a fat blue arrow, right click on it and select "Delete Breakpoint".

Ok, I got rid of this, I actually had a button link on the main.interface builder that wasn't referring to the viewcontroller, I deleted it and relinked the button while the view controller yellow button pressed, and it worked...

Thanks for the help anyways :-)