架构 arm64 的未定义符号:libyoga.a(Yoga.o) 中的 _YGConfigNew

Undefined symbols for architecture arm64: _YGConfigNew in libyoga.a(Yoga.o)

当我使用 XCodereact-native run-ios 在 iOS 模拟器 [=27= 中启动我的应用程序时], 效果不错。

但是如果我在真实设备上做同样的事情,它就不起作用了。我遇到了这个错误:

Undefined symbols for architecture arm64:
   "YGConfig::YGConfig(int (*)(YGConfig*, YGNode*, YGLogLevel, char const*, char*))", referenced from:
      _YGConfigNew in libyoga.a(Yoga.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

更多信息:

react: 16.9.0
react-native: 0.60.5
Real device: iPad with iOS 12.4.4

有人有解决办法吗?谢谢

我刚刚花了最后一个小时来解决这个完全相同的问题,并在他们的回购协议中偶然发现了这条评论,最终为我解决了这个问题。在我的例子中,结果证明是 Xcode 的缓存问题:

https://github.com/facebook/react-native/issues/25349#issuecomment-518830530

close xcode and any other IDE
rm -rf ~/library/developer/xcode/deriveddata
rm -rf ~/.rncache
rm -rf node_modules && npm install && cd ios && rm -rf Pods && pod install && cd ..

希望这对你也有帮助!