我正在尝试在我的快速代码中获取react native桥模块的实例。确切地说,是在共享扩展内。
class ShareViewController: SLComposeServiceViewController {
var moduleInitializer: ModuleInitializer?
var bridge: RCTBridge?
override func viewDidLoad() {
self.moduleInitializer = ModuleInitializer()
self.bridge = RCTBridge(delegate: self.moduleInitializer, launchOptions: nil)
}
}
还有我的ModuleInitializer类:
@objc(ModuleInitializer)
class ModuleInitializer: NSObject {
static let sharedInstance = ModuleInitializer()
}
extension ModuleInitializer: RCTBridgeDelegate {
func sourceURL(for bridge: RCTBridge!) -> URL! {
let url = RCTBundleURLProvider
.sharedSettings()?
.jsBundleURL(forBundleRoot: "index", fallbackResource: nil)
return url
}
}
代码看起来不错,编辑器也没有抱怨。我遵循了this guide上的示例,并在github repo
上查看了它们的代码当我尝试在Xcode中运行我的应用程序时,出现96个错误,这些错误我都不知道。也许有人在这里看到了类似的东西,或者可以破译这种神秘的错误
x86_64体系结构的未定义符号:
“ std :: __ 1 :: system_error :: system_error(int,std :: __ 1 :: error_category const&,char const *)“,引用自: libReact.a(JSBigString.o)中的folly :: makeSystemErrorExplicit(int,char const *) std :: __ 1 :: system_error folly :: makeSystemErrorExplicit, std :: __ 1 :: allocator> const&>(int,char const(&&&)[20], std :: __ 1 :: basic_string, libReact.a(JSBigString.o)中的std :: __ 1 :: allocator> const &&&)
从以下位置引用的“ std :: __ 1 :: system_error的typeinfo” libReact.a(JSBigString.o)中的folly :: throwSystemErrorExplicit(int,char const *) 无效的愚蠢的:: throwSystemErrorExplicit, std :: __ 1 :: allocator> const&>(int,char const(&&&)[20], std :: __ 1 :: basic_string, libReact.a(JSBigString.o)中的std :: __ 1 :: allocator> const &&&)
从以下位置引用的“ std :: __ 1 :: system_error ::〜system_error()” libReact.a(JSBigString.o)中的folly :: throwSystemErrorExplicit(int,char const *) 无效的愚蠢的:: throwSystemErrorExplicit, std :: __ 1 :: allocator> const&>(int,char const(&&&)[20], std :: __ 1 :: basic_string, libReact.a(JSBigString.o)中的std :: __ 1 :: allocator> const &&&)
“ std :: __ 1 :: basic_ostream:: operator <<(long long)“,引用自: libReact.a(JSBigString.o)中的facebook :: react :: JSBigFileString :: c_str()const“ std :: __ 1 :: basic_string,std :: __ 1 :: allocator :: resize(unsigned long,char)“,引用自: libReact.a(String.o)中的std :: __ 1 :: basic_stringbuf,std :: __ 1 :: allocator> :: overflow(int)
“ std :: __ 1 :: basic_ostream :: sentry :: sentry(std :: __ 1 :: basic_ostream>&)“,引用自: std :: __ 1 :: basic_ostream>&std :: __ 1 :: __ put_character_sequence libReact.a(CxxNativeModule.o)中的(std :: __ 1 :: basic_ostream>&,char const *,unsigned long)