且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

React Native iOS构建失败:架构x86_64的未定义符号

更新时间:2023-01-02 09:53:32

您是否按照



此外,您还需要添加依赖项

  pod'React',:path =>上的RCTBatchedBridge子规范(如果使用0.46)或RCTCxxBridge(如果使用较新)。 ‘../node_modules/react-native’,:subspecs => [
'Core',
'DevSupport',#如果RN> = 0.43
[...]
'BatchedBridge',#包括此项以启用应用内开发菜单如果RN = 0.46
'CxxBridge'#包括如果RN> = 0.47
]


I'm building an iOS app with React Native. Doing so, I installed a react-native module and configured my iOS xcode project (cocoapods mainly) following the module tutorial. Now, when I run react-native run-ios, I get this error stack :

Undefined symbols for architecture x86_64:

"_JSNoBytecodeFileFormatVersion", referenced from:

+[RCTJavaScriptLoader loadBundleAtURL:onProgress:onComplete:] in RCTJavaScriptLoader.o

+[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in RCTJavaScriptLoader.o "facebook::react::IRemoteConnection::~IRemoteConnection()", referenced from:

RemoteConnection::~RemoteConnection() in RCTInspector.o "facebook::react::parseTypeFromHeader(facebook::react::BundleHeader const&)", referenced from:

+[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in RCTJavaScriptLoader.o

"facebook::react::customJSCWrapper()", referenced from:

-[RCTDevSettings isJSCSamplingProfilerAvailable] in RCTDevSettings.o

-[RCTDevSettings toggleJSCSamplingProfiler] in RCTDevSettings.o ____ZL11getInstancev_block_invoke in RCTInspector.o

_RCTNSErrorFromJSErrorRef in RCTJSCErrorHandling.o

-[RCTSamplingProfilerPackagerMethod handleRequest:withResponder:] in RCTSamplingProfilerPackagerMethod.o

"facebook::react::systemJSCWrapper()", referenced from:

-[RCTDevSettings isJSCSamplingProfilerAvailable] in RCTDevSettings.o

-[RCTDevSettings toggleJSCSamplingProfiler] in RCTDevSettings.o

_RCTNSErrorFromJSErrorRef in RCTJSCErrorHandling.o

-[RCTSamplingProfilerPackagerMethod handleRequest:withResponder:] in RCTSamplingProfilerPackagerMethod.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

The following build commands failed:

Ld /Users/antoine/R/devlab/ReactNative/medway-twilio/MedwayTwilio/ios/build/Build/Products/Debug-iphonesimulator/React/React.framework/React normal x86_64 (1 failure)

I suspect this is related to the inclusion of libraries and frameworks to the project with xcode, but I'm not sure.

This is a screenshot of my project target/build phases/link binary with libraries panel in xcode :

Where "MedwayTwilio" is my project name

Did you configured your CocoaPods dependencies as described in the documentation?

Also, you need to add a dependency on the RCTBatchedBridge subspec (if using 0.46) or RCTCxxBridge (if newer).

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    [...]
    'BatchedBridge', # Include if RN = 0.46
    'CxxBridge' # Include if RN >= 0.47
  ]