体系结构x86_64的未定义符号:将扩展目标添加到react-native项目之后

Ove*_*d D 5 objective-c react-native

我使用I创建了一个react-native项目react-native init 然后使用File - > new - > target - > Action Extension为该项目添加了一个动作扩展,名称为"Stash"我尝试添加一个继承自UIView的StashView,并包含一个RCTRootView ,按照与现有应用程序集成说明中的说明:

藏匿/ StashView.h:

#import <UIKit/UIKit.h>

@interface StashView : UIView

@end
Run Code Online (Sandbox Code Playgroud)

藏匿/ StashView.m:

#import "StashView.h"
#import "RCTRootView.h"

@implementation StashView
- (void)awakeFromNib {
   NSString *urlString = @"http://localhost:8081/stash.ios.bundle";
   NSURL *jsCodeLocation = [NSURL URLWithString:urlString];
   RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName: @"Stash"
                                                   launchOptions:nil];
  [self addSubview:rootView];
  rootView.frame = self.bounds;
}
@end
Run Code Online (Sandbox Code Playgroud)

当我编译时,我收到错误:

架构x86_64的未定义符号:
"_ OBJC_CLASS _ $ _ RCTRootView",引用自:StashView.o中的objc-class-ref ld:未找到架构x86_64的符号clang:错误:链接器命令失败,退出代码为1(使用-v看看调用)

完整堆栈跟踪:

Ld /Users/danoved/Library/Developer/Xcode/DerivedData/ToDoBox-gmtanlmumdrkqactpypioaempcuc/Build/Products/Debug-iphonesimulator/Stash.appex/Stash normal x86_64 cd/Users/danoved/Source/myprojects/ToDoBox export IPHONEOS_DEPLOYMENT_TARGET = 8.1 export PATH ="/应用/ Xcode.app /内容/开发/平台/ iPhoneSimulator.platform /开发人员的/ usr/bin中:/Applications/Xcode.app/Contents/Developer/usr/bin:在/ usr/bin中:/ bin中:在/ usr/sbin:/ sbin"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/ Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/danoved/Library/Developer/Xcode/DerivedData/ToDoBox-gmtanlmumdrkqactpypioaempcuc/Build/Products/Debug-iphonesimulator -F/Users/danoved/Library/Developer/Xcode/DerivedData/ToDoBox-gmtanlmumdrkqactpypioaempcuc/Build/Products/Debug-iphonesimulator -filelist/Users/danoved/Library/Developer/Xcode/DerivedData/ToDoBox-gmtanlmumdrk qactpypioaempcuc/Build/Intermediates/ToDoBox.build/Debug-iphonesimulator/Stash.build/Objects-normal/x86_64/Stash.LinkFileList -Xlinker -rpath -Xlinker @ executable_path/Frameworks -Xlinker -rpath -Xlinker @executable_path /../. ./Frameworks -Xlinker -objc_abi_version -Xlinker 2 -OjbC /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit -e _NSExtensionMain -fobjc-arc -fobjc-link-runtime -fapplication-extension -Xlinker -no_implicit_dylibs -mios-simulator-version-min = 8.1 -Xlinker -dependency_info -Xlinker/Users/danoved/Library/Developer/Xcode/DerivedData/ToDoBox-gmtanlmumdrkqactpypioaempcuc/Build/Intermediates/ToDoBox.build/Debug-iphonesimulator/Stash.build/Objects-normal/x86_64/Stash_dependency_info.dat -o/Users/danoved/Library/Developer/Xcode/DerivedData/ToDoBox-gmtanlmumdrkqactpypioaempcuc/Build /产品/调试-iphonesimulator/Stash.appex /藏匿处

我究竟做错了什么?构建设置中有什么东西?

Ove*_*d D 8

弄清楚了!

根据这里答案

我不得不在扩展的Build Phases中打开Link Binary和Libraries carrot,并将所有反应库添加到它:

在此输入图像描述