【发布时间】:2016-06-19 20:32:54
【问题描述】:
从默认的 React Native 项目开始,我遵循了创建键盘扩展的指南,并且默认的 Apple 代码可以正常工作。但是当我将#import <RCTRootView.h> 添加到我的文件中时,以下是扩展 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)
我从这个类似的问题Using React Native within an iOS share extension 将Other Linker Flags -ObjC 添加到扩展目标构建设置中
我的代码在这里: https://github.com/jeremyhicks/react-native-keyboard-extension
【问题讨论】:
标签: ios keyboard react-native ios-extensions