Fixing React Native build error: Undefined symbols for architecture x86_64

--

While running yarn ios for React Native v0.64.2 on my mac machine (macOS 11.6, XCode 13) i’ve encountered following error:

Undefined symbols for architecture x86_64:
"__swift_FORCE_LOAD_$_swiftDataDetection", referenced from:
__swift_FORCE_LOAD_$_swiftDataDetection_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftDataDetection_$_YogaKit)
"__swift_FORCE_LOAD_$_swiftFileProvider", referenced from:
__swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It seems that adding libswiftWebKit.tbd into Link Binary With Libraries build phase in XCode helped to solve the problem:

The answer was first posted in this thread.

--

--