2015-05-08 46 views
5

我使用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

我在做什麼錯?在構建設置中的東西?

回答

7

想通了!

基礎上answer here

我不得不在延長的構建階段,打開鏈接二進制與圖書館胡蘿蔔,並添加所有的反應庫吧:

enter image description here

相關問題