0

I know this question has been asked a lot but the answers do not work for me. For this class:

import UIKit

class ProfileViewController: UIViewController {
    @IBOutlet weak var bioTextView: UITextView!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

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

I have added an outlet from my storyboard to the bioTextView. There are no other outlets on this view in the storyboard, all I have done is add an outlet and nothing else and I get the error. There were other other outlets to an Objective-C file that I am replacing, and those outlets, along with the file, are deleted. I keep getting this error: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fc86bc08700> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key bioTextView.'

Any answers with clear instructions not written for someone who already knows how to code in Xcode would be greatly appreciated.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
AlexK
  • 336
  • 8
  • 21
  • 41
  • The error says that `UIViewController` is not compliant for that key. It says nothing about `ProfileViewController`. So, you must have neglected to set the base class for your scene in IB. – Rob Jan 20 '18 at 22:05
  • Can you explain a little more? How do I set the base class for a scene? – AlexK Jan 21 '18 at 00:51
  • In IB, select the view controller (e.g. by clicking on the bar above the storyboard scene) and then go to the "identity inspector" (the third tab in the right panel) and look at the "Custom Class" section. Your `ProfileViewController` should be in the "Class" field. Judging by your error message, it will probably currently have `UIViewController` in light gray (meaning that in the absence of any specific subclass, it will default to `UIViewController`). – Rob Jan 21 '18 at 01:01
  • 1
    Thank you for your help. It has already said ProfileViewController, but I believe it was connecting to the old Objective-C file of the same name which I had deleted. I cleared and re-entered the string and worked. – AlexK Jan 21 '18 at 01:09

0 Answers0