升级到 React Native 0.62.2 iOS错误: Undefined symbol _swift_getFunctionReplacement

React Native 2020-04-29 阅读 157 评论 0

问题描述

将 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,然后重新编译。

最后更新 2020-04-29
MIP.watch('startSearch', function (newVal, oldVal) { if(newVal) { var keyword = MIP.getData('keyword'); console.log(keyword); // 替换当前历史记录,新增 MIP.viewer.open('/s/' + keyword, {replace: true}); setTimeout(function () { MIP.setData({startSearch: false}) }, 1000); } }); MIP.watch('goHome', function (newVal, oldVal) { MIP.viewer.open('/', {replace: false}); });