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

Gar*_*tua 3 xcode ios cocoapods react-native

当我使用XCodereact-native run-ios在 iOS模拟器中启动我的应用程序时,它运行良好。

但是如果我在真实设备上做同样的事情,它就行不通了。我有这个错误:

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)
Run Code Online (Sandbox Code Playgroud)

更多信息:

react: 16.9.0
react-native: 0.60.5
Real device: iPad with iOS 12.4.4
Run Code Online (Sandbox Code Playgroud)

有人有解决方案吗?谢谢

Eri*_*ric 5

我刚刚花了最后一个小时用这个完全相同的问题把我的头撞在墙上,并在他们的 repo 中偶然发现了这条评论,最终为我修复了它。就我而言,结果是 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 ..
Run Code Online (Sandbox Code Playgroud)

希望这也能帮助你!