为什么我会在带有 react-native 的 xcode 上收到此错误:“模块导入出现在命名空间内”?

Ale*_*age 5 xcode glog cocoapods react-native react-native-ios

我得到了这个 react-native 项目,我不得不use_modular_headers!Podfile. 我想我需要它,因为这pod MercadoPagoSDK是某种动态库(?°?°??我真的不知道这在 iOS 开发世界中意味着什么。

现在我在 xcode 上构建时遇到这个错误!

import of module 'glog.glog.log_severity' appears within namespace 'google'

我没有找到解决这个user_modular_headers!问题的方法。我已经尝试了https://github.com/google/glog/issues/393 中的所有想法,但恐怕它们都不起作用。

小智 9

确保将以下代码添加到您的 podfile 中,包括 modular_headers 部分:

pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false

有关更多信息,请查看此处的完整线程:https ://github.com/facebook/react-native/issues/26217