Swift EXC_BAD_INSTRUCTION (EXC_i386_INVOP) with Label

45 views Asked by At

I'm new to Swift so if this is a basic question don't burn me at the stake. Before I start, I'd like to say I am running a virtual machine (hackintosh) on windows 10, using Mac OS X Sierra.

The project is a page-based application on Xcode 8. Even without adding code at all, just label text w/o actions or outlets, and trying to run the code, gives me an error.

The code w/ the error:

import UIKit

class DataViewController: UIViewController {
    @IBOutlet weak var dataLabel: UILabel!
    var dataObject: String = ""

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.dataLabel!.text = dataObject; // error here
    }
}

enter image description here

Been stuck on this and can't find much.

0

There are 0 answers