Latcie Latcie - 1 year ago 94
iOS Question

Referencing outlet file's owner

I can't figure out why it's crashing with "this class is not key value coding-compliant for the key profilePic" in this picture.

enter image description here

Answer Source

With storyboard scenes, the view controller instance class is set by the custom class assigned to the view controller scene. With NIB files you are responsible for initialising the correct class instance yourself:

Rather than

let initialViewController = UIViewController.init(nibName: "InitialViewController", bundle: nil) as! InitialViewController

You need to have

let initialViewController = InitialViewController(nibName:"InitialViewController". bundle: nil)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download