Symtom
While adding App Clip target to the original target, the following uncaught exception occurred. As for the normal app target works fine. Only on App Clip Target did not work.
2021-02-23 05:48:05.968176+0900 NegaViewerAppClip[7319:368124] [Storyboard] Unknown class _TtC10NegaViewer18MainViewController in Interface Builder file.
2021-02-23 05:48:06.032046+0900 NegaViewerAppClip[7319:368124] *** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<UIViewController 0x7f93b5e20ac0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imageViewOut.’
*** First throw call stack:
(
0 CoreFoundation 0x00007fff20421af6 __exceptionPreprocess + 242
…
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<UIViewController 0x7f93b5e20ac0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imageViewOut.’
terminating with uncaught exception of type NSException
CoreSimulator 732.18.6 – Device: iPhone 12 Pro Max (31C0DAD9-EF0A-4822-A496-75B919FEB25E) – Runtime: iOS 14.4 (18D46) – DeviceType: iPhone 12 Pro Max
(lldb)
Cause
It happened while I was refactoring (renaming) the class.
In the main storyboard, the Module of MainViewController was specified the original application target. So, MainViewController is bundled only for the original application target.
Solution
Check “Inherit Module From Target” as follows and it worked.