Crash on pushViewController with [NSNull set]: unrecognized selector

I have an app where I just created a new, working viewController in a separate project. I copy/pasted the code and xibs (several subviews) into the new project. All compiles fine. Relevant code:

`let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)

//let nextViewController = storyBoard.instantiateViewController(withIdentifier: "NewManualGlyphVC") as! NewManualPickGlyphViewController //old Selector

let nextViewController = storyBoard.instantiateViewController(withIdentifier: "GlyphSelectVC") as! GlyphSelectViewController //new Selector

self.navigationController?.pushViewController(nextViewController, animated: true) `

The commented out line was the vector to the old, working VC. The new code crashes inside the push. the new nextViewController is fine, the Xcode quick view shows the expected view, and the navController is also just fine. The reported error is:

`myApp[42661:963870] -[NSNull set]: unrecognized selector sent to instance 0x7ff86599bc30

` Environment is Xcode 14.3.1 compiled to ios13, target device iOS 16. Any thoughts? Thanks!!

My guess is that you have an invalid outlet connection in the storyboard (or a XIB, if you're using those too). The NSNull object may be what's being set as the linked object when the outlet is broken.

When you changed the view controller name from NewManualPickGlyphViewController, to GlyphSelectViewController, did you remember to update the class name of the corresponding view controller entities in your storyboard/XIBs?

The old VCs and IB Xibs are still in place. In transitioning to the new VC, I just pasted the new classes (all with different names) into the project. I rechecked all the outlets in the IB Connections pane and they all go to the correct place.

I appreciate the thought though. LLDB does not catch the NSNull call so I can’t see where it’s coming from.

might you have any other thoughts I can track down. This one stumps me.

The old VCs and IB Xibs are still in place.

I'm not sure what this means in terms of the new project. Did you actually check that all of your class names are correct in the Identity inspector for the various resource files?

You could also do a project-wide search for the old names, then a search for the new names, and make sure they're all one thing or the other. (Xcode's project-wide search will search in storyboard and XIB files.)

Crash on pushViewController with [NSNull set]: unrecognized selector
 
 
Q