52inc/Pulley

UIViewController not key value coding-compliant

thomas-oo opened this issue · 10 comments

I'm getting an exception when I try to switch to a pulleyViewController

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x143d485f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key drawerContentContainerView.

As per instructions, I added two container views in the pulleyviewcontroller and linked the outlet drawerContentContainer to a container view. And, I also linked the outlet primaryContentContainer to the other container view. These two container views segue to ordinary UIViewControllers.

I did not do any customization but I am getting this exception. My project is primilary objective-c but I don't think this has much to do with it. I even tried to use a forked project https://github.com/tadelv/Pulley/tree/objc_friendly but the exception still arises.

TLDR: followed insturctions to setup PulleyViewController in interface builder, NSUnknownKeyException arises

It looks like you haven't set the subclass of the view controller to "PulleyViewController" in your Storyboard.

If you had, this would say "PulleyViewController" instead of "UIViewController":

'[<UIViewController 0x143d485f0> setValue:forUndefinedKey:]:

Checkout the example project in the main repo for a working example.

I finally got it!
I did subclass the view controller to PulleyViewController but when I checked your demo project, I noticed the module was Pulley and that I hadn't set a module in my project. I set the module to Pulley and voila, it worked! I guess if you don't set the module, it can't find the PulleyViewController?

Anyways I'm so happy, I've been wanting to make this work for so long! great work on this and cheers

Ah! That would do it! Nice find. Let me know if you have any questions.

Just realised this 3 seconds before finding this thread. Maybe this piece of info is worth to be added to the Readme?

Stumbled across this problem too. Would never have found the solution without finding this.

Added a note about this (with a link to the issue) to the Interface Builder section of the README. Thanks for the heads up everyone!

@alpa99 Please make a new issue and I can assist you there. Posting in this issue isn’t on topic.

Xcode 9.1.4, latest version of Pulley. If I have the Module as Pulley, I get:

Unknown class _TtC6Pulley20PulleyViewController in Interface Builder file.

If I set the Module to None, I get:

Unknown class PulleyViewController in Interface Builder file.

Both situations crash.

If I check "Inherit Module From Target", then it works.

That is an expected Interface Builder behavior, and not related to Pulley.