0

I'm very new to coding so I really have no idea what's going on.

I've tried pasting the error into this website and looked around for people's responses but they either slightly altered from my error code or their explanation was too convoluted for me.

Code:

import UIKit

class BasicsListScreen: UIViewController {
    @IBOutlet weak var tableView: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()    
   }
}

extension BasicsListScreen: UITableViewDelegate, UITableViewDataSource {

    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 70
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return basics.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? TableViewCell
        cell?.verbLabel.text = basics[indexPath.row]
        return cell!
     }

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let vc = storyboard?.instantiateViewController(withIdentifier: "ConjViewController") as? ConjViewController

        vc?.pastMe = mePast[indexPath.row]

        vc?.pastYou = youPast[indexPath.row]
        vc?.pastHe = hePast[indexPath.row]
        vc?.pastShe = shePast[indexPath.row]
        vc?.pastWe = wePast[indexPath.row]
        vc?.pastYall = yallPast[indexPath.row]
        vc?.pastThey = theyPast[indexPath.row]
        vc?.pastPassive = passivePast[indexPath.row]
        vc?.presentMe = mePresent[indexPath.row]
        vc?.presentYou = youPresent[indexPath.row]
        vc?.presentHe = hePresent[indexPath.row]
        vc?.presentShe = shePresent[indexPath.row]
        vc?.presentWe = wePresent[indexPath.row]
        vc?.presentYall = yallPresent[indexPath.row]
        vc?.presentThey = theyPresent[indexPath.row]
        vc?.presentPassive = passivePresent[indexPath.row]

        self.navigationController?.pushViewController(vc!, animated: true)
    }
}

28784:1039713] Unknown class BasicsListScreen in Interface Builder file. 2019-07-10 13:30:01.795516+0100 App[28784:1039713] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[< UIViewController 0x7fcc87619000> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tableView.' * First throw call stack: (

Larme
  • 24,190
  • 6
  • 51
  • 81

3 Answers3

0

The error message sounds like a broken connection in BasicMathLevelOne.xib. It is the result from KVC trying to set a value on your InheritController for the key "you" but the class has no KVC compliant accessor (any more?).

To find the exact spot where the error occurs set an exception breakpoint in Xcode (press Command-6, click the "+" in lower left corner, chose "Add Exception Breakpoint"). Running the app in the debugger should make it stop at the place where the error occurs.

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
  • The only options that come up are: New Unit Test Target, New Unit Test Class, New UI Test Target and New UI Test Class – Chris Thomas Jul 10 '19 at 12:57
0

Attach your tableView IBOutlet in code to your UITableView in Interface Builder.

Start Developing iOS Apps (Swift): Connect the UI to Code

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
0

Take a look at this page Terminating app due to uncaught exception 'NSUnknownKeyException' : iOS app crash. There may be a broken connection to a referenced outlet. The page above shows you what that looks like.

Another thing to look at is to make sure your table view is connected to the right class as Daniel Storm said. Open your storyboard and click on the view that you think is connected BasicsListScreen. Open the "Inspector" by clicking the button in the far upper right of Xcode. Then click "Identity Inspector" which is the middle button. It should show BasicsListScreen in the "Custom Class". Make sure that is right.

Tim Burnham
  • 11
  • 1
  • 2