升级到 React Native 0.62.2 iOS错误: Undefined symbol _swift_getFunctionReplacement
问题描述
将 React Native 从 0.61.5 升级到 0.62.2 时,Xcode 编译时出现错误:
Undefined symbols for architecture x86_64:
"_swift_getFunctionReplacement", referenced from:
_swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
(maybe you meant: _swift_getFunctionReplacement50)
"_swift_getOrigOfReplaceable", referenced from:
_swift_getOrigOfReplaceable50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
(maybe you meant: _swift_getOrigOfReplaceable50)
解决方法
设置 Dead Code Stripping 为 YES。
在 Xcode 中,依次选择 PROJECT -> Build Settings -> LInking -> Dead Code Stringpping,设置为 YES,然后重新编译。