【问题标题】:How to add iOS keyboard extension to react native?如何添加 iOS 键盘扩展来响应原生?
【发布时间】: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 extensionOther Linker Flags -ObjC 添加到扩展目标构建设置中

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

【问题讨论】:

    标签: ios keyboard react-native ios-extensions


    【解决方案1】:

    您似乎没有将扩展程序链接到 react-native。您需要将当前位于容器应用目标 (ReactAGKeyboard) 的 Linked Frameworks and Libraries 中的 .a 文件添加到扩展目标 (AGKeyboard)。

    【讨论】:

      猜你喜欢
      • 2014-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-11
      • 1970-01-01
      • 2014-12-19
      相关资源
      最近更新 更多