Unknown class in Interface Builder file + NSUnknownKeyException

Hi


I'm building a today extension which works fine on iOS13+ but somehow it doesn't work for the versions below.


On other versions I get following error:


2019-12-20 08:45:41.741 MyWidget[4730:53043] Unknown class _TtC14MyWidget19TodayViewController in Interface Builder file.

2019-12-20 08:45:41.850 MyWidget[4730:53043] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7ffe59401f10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key loginViewNew.'


At first I thought it was caused because in the properties under Interface Builder Document builds for was set to iOS13 and later, so I changed this in my storyboard and all my other .xib files but this did not solve the problem, I still get the same error.


I also checked my outlets and there are no errors there as well, storyboard can find my TodayViewController class so I have no clue what the problem can be.


Does anyone have suggestions for solving this problem?

Replies

Pretty often, it is a connection issue.

Even if they seem correct, they may be damaged.

Rebuild the connections to IBOutlets and actions:

- remove the connections (click the small x in Connections Inspector

- rebuild connections

- do an option-clean build folder


Do you uise value(forKey:) ?

May be missing an @objc declaration.

See illustration here:

https://forums.developer.apple.com/message/303412#303412


Would help to show the code with the part where the error occurs (please show enough code so that we get the context).