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

问题描述

我得到了这个 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但恐怕它们都没有奏效。

标签: xcodereact-nativecocoapodsreact-native-iosglog

解决方案


确保将以下内容添加到您的 podfile 中,包括 modules_headers 部分: pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false

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


推荐阅读