Search code examples
objective-cios-keyboard-extension

_OBJC_CLASS_$_KeyboardViewController", referenced from:objc-class-ref in KeyboardPreferencesController.o


I am totally stuck with an error I am getting when trying to test project on the simulator.

Error looks like:

Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_KeyboardViewController", referenced from: objc-class-ref in KeyboardPreferencesController.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am building custom keyboard using keyboard extension and what I am trying to do is that in main application I am implementing settings view to modify keyboard like font change... so of course, it needs to be linked to extension header file KeyboardViewController.h

I have tried to add Other Linker Flags -> $(inherited) in both debug and release, also tried to switch Build Active Architecture Only -> YES but it also does not worked for me.

So is there any other solution for this because I can not find anything what will work for me.

Thanks in advance!


Solution

  • You need to compile and link the implementation file (KeyboardViewController.m?) into your target.

    Use Xcode's File Inspector to make sure target membership is turned on. Look at the build phases to make sure the implementation file is included.

    If those things are correct, look at the KeyboardViewController.m to make sure it actually has a @implementation section.