2016-03-06 105 views
0

从默认的React Native项目开始,我遵循用于创建键盘扩展和默认Apple代码的指导原则。但是,当我加入#import <RCTRootView.h>我的文件,以下是在扩展的ViewController文件的唯一代码:如何添加iOS键盘扩展来反应原生?

- (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) 

我加Other Linker Flags -ObjC扩张对象建立从这个类似的问题Using React Native within an iOS share extension

我的代码的设置是在这里: https://github.com/jeremyhicks/react-native-keyboard-extension

回答

0

看起来你并没有将你的扩展连接到react-native。您需要将当前位于容器应用目标(ReactAGKeyboard)的Linked Frameworks and Libraries中的.a文件添加到您的扩展目标(AGKeyboard)。

+0

得到它编译,谢谢。 –