体系结构x86_64的未定义符号:将扩展目标添加到反应原生项目之后

问题描述:

我使用react-native init 创建了react-native项目然后使用File - > new - > target - > Action为该项目添加一个操作扩展拓,名称为 “藏匿” 我尝试添加来自继承的UIView,并包含一个RCTRootView StashView,按照指示在Integration with Existing App instructions体系结构x86_64的未定义符号:将扩展目标添加到反应原生项目之后

藏匿/ StashView.h:

#import <UIKit/UIKit.h> 

@interface StashView : UIView 

@end 

藏匿/ 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 

当我编译,我得到的错误:

Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RCTRootView", referenced from: objc-class-ref in StashView.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

完整的堆栈跟踪:

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="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/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-gmtanlmumdrkqactpypioaempcuc/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/Products/Debug-iphonesimulator/Stash.appex/Stash

我在做什么错?在构建设置中的东西?

想通了!

基础上answer here

我不得不在延长的构建阶段,打开链接二进制与图书馆胡萝卜,并添加所有的反应库吧:

enter image description here