'NSUnknownKeyException for a UIButton. Correctly added referencing outlets and corresponding function

I am facing an NSUnknownKeyException for a back button present on a Storyboard, i.e. FastGazeExtension. I have correctly connected the back button to the UIButton outlet property in the controller, i.e. backBTN_FGE, and referenced an action function, i.e. backToWebPageMenu for the back button that wouldn't do anything for now. Additionally, none of the referencing outlets show any inactive connections. How can I solve the following exception:

2022-05-02 19:13:22.836066-0400 Application1[12433:4224720] [Storyboard] Unknown class _TtC8EApplication118FastGazeController in Interface Builder file.
2022-05-02 19:13:22.839695-0400 Application1[12433:4224720] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x137ecdef0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key backBTN_FGE.'
*** First throw call stack:
(0x19a88e86c 0x1af8a7c50 0x19a7965c8 0x19bad8f58 0x19cb17dd8 0x19ce54fa4 0x19a76e0c8 0x19ce50d6c 0x19cb1f8c0 0x19cb1fc7c 0x19cb20334 0x19ca0d5c0 0x19ca00798 0x19cb32750 0x19cb33a6c 0x19cb33dcc 0x19cb339b8 0x19cb33ea8 0x104bd4ea4 0x104b165f4 0x104b16710 0x1a7081270 0x1a71718b4 0x1a717f888 0x1a717f6fc 0x1a744e0a0 0x1a6e6da1c 0x1a71a25dc 0x1a6e50c4c 0x1a6e50490 0x1a4b795e0 0x1a4b7a2c8 0x19a80a76c 0x19a80a668 0x19a809960 0x19a803a8c 0x19a80321c 0x1b23cd784 0x19d243ee8 0x19d24975c 0x104b1974c 0x19a4c36b0)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x137ecdef0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key backBTN_FGE.'
terminating with uncaught exception of type NSException

FastGazeController: Controller associated with the Storyboard.

Connections for the key under consideration: enter image description here

All referencing outlets in the storyboard: enter image description here

Note: I have copied this storyboard in my application from another application.



Solution 1:[1]

The first line of the warning/error stated: 2022-05-02 19:13:22.836066-0400 Application1[12433:4224720] [Storyboard] Unknown class _TtC8EApplication118FastGazeController in Interface Builder file.

The Interface Builder couldn't find the controller file and all of the subsequent referencing outlets were marked as not key-value coding-compliant.

After digging into the problem for some time, I found out that the target membership for folder (A) containing the controller file(B) included my application. However, target membership was not visible for the controller file itself. When I deleted folder A and added a new swift file(C) inside another folder that hadn't any visible target membership associated with it, and included logic of file B inside this new file/controller (C), it started working.

Note: I included my application directly as a target member of file C. I associated file C with the storyboard that I was working on.

Later on, I didn't face any issues with referencing.

Solution 2:[2]

Go to your controller in storyboard. Delete the class name "ie: FastGazeController". Type it again and press enter.

Also check if you added the copied files to the target.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sumeet Pannu
Solution 2 hasan