如何将iOS键盘扩展添加到react native?

如何将iOS键盘扩展添加到react native?,ios,keyboard,react-native,ios-extensions,Ios,Keyboard,React Native,Ios Extensions,从默认的React原生项目开始,我遵循了创建键盘扩展的指导原则,默认的Apple代码可以正常工作。但是当我将#import添加到我的文件时,扩展名ViewController文件中只有以下代码: - (void)loadView { NSURL *jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; RCTRootView *rootV

从默认的React原生项目开始,我遵循了创建键盘扩展的指导原则,默认的Apple代码可以正常工作。但是当我将
#import
添加到我的文件时,扩展名ViewController文件中只有以下代码:

- (void)loadView {
NSURL *jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                  moduleName:@"ReactAGKeyboard"
                                           initialProperties:nil
                                               launchOptions:nil];
self.view = rootView;
}
生成将失败,并出现错误:

 Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTRootView", referenced from: objc-class-ref in KeyboardViewController.o
 ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see invocation)
我在这个类似问题的扩展目标构建设置中添加了
其他链接器标志-ObjC

我的代码在这里:

看起来您没有将扩展链接到react native。您需要将当前位于容器应用程序目标(ReactAGKeyboard)的链接框架和库中的.a文件添加到扩展目标(AGKeyboard)中