I am trying to create an app with three tabs. I have the ViewControllers all setup and working, however when I try to run a Web View on any of the different tabs, other than the fist, it crashes with a message like this:
2016-10-06 23:17:54.565932 Techaway[6827:2354958] Unknown class ThirdViewController in Interface Builder file.
2016-10-06 23:17:59.520639 Techaway[6827:2354958] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Techaway.SecondViewController 0x100f0bc20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Home.'
It works perfectly if in the first ViewController though, which confuses me.
Example of the code in SecondViewController:
import UIKit
class SecondViewController: UIViewController {
var url = URL(string: "https://example.com/")!
@IBOutlet weak var webView: UIWebView!
@IBAction func home(_ sender: AnyObject) {
webView.loadRequest(URLRequest(url: url))
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
webView.loadRequest(URLRequest(url: url))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
I just don't understand why it works in one place but not another!