gpt4 book ai didi

objective-c - 体系结构 x86_64 : after adding an extension target to a react-native project 的 undefined symbol

转载 作者:太空狗 更新时间:2023-10-30 03:49:55 33 4
gpt4 key购买 nike

我使用 react-native init 创建了一个 react-native 项目然后我使用 File -> new -> target -> Action Extension 为该项目添加一个 Action 扩展,名称为“Stash”我尝试添加一个继承自 UIView 并包含 RCTRootView 的 StashView,如 Integration with Existing App instructions 中的说明:

存储/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

我做错了什么?build设置中有什么?

最佳答案

想通了!

基于answer here

我必须在扩展的构建阶段打开带有库胡萝卜的链接二进制文件,并将所有反应库添加到其中:

enter image description here

关于objective-c - 体系结构 x86_64 : after adding an extension target to a react-native project 的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30133459/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com