ios - React Native iOS 模块 Pod 依赖

标签 ios react-native react-native-ios

我正在尝试使用从我的自定义 native 模块中的 Podfile 安装的依赖项,但我没有成功。当我安装我的 pod 时,我可以在我的项目中正常使用它们,但看起来库(一个 React Native 原生模块)无法使用安装的 pod。

请记住:我的 Podfile 没问题,我什至可以在主项目中使用已安装的依赖项,但不能在 native 模块中使用。

我总是在自定义库中的 .m/.swift 文件中收到“找不到模块 XXX”错误。

我错过了什么吗?对不起,如果我解释错了,我困了...

最佳答案

我假设您的 native 模块是通过将 .xcproj 拖入您的主项目来导入的。

在 native 模块的项目中:转到 Build Settings > Header Search Paths 并添加:{PATH_TO_IOS_BASE}/Pods/{NAME_OF_POD} 并将其设置为 recursive 然后你应该能够从你的 ObjC 文件中导入它。

注意:您也可以将相应的 pod 文件夹拖到 Search Header Paths 中。

例如,对于通过 npm 安装的 native 模块,我会使用:$(SRCROOT)/../../../../ios/Pods/{NAME_OF_POD

关于ios - React Native iOS 模块 Pod 依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48573900/

相关文章:

react-native - 为什么 React Native Navigation v2 图标未在 iOS 中显示?

javascript - 如何在 React Native 中创建跨平台图标?

react-native - 添加react-navigation@^4.0.0后找不到RCTImageLoader.h

ios - 如何创建高度取决于 subview 的 View ?

iphone - 内部图像需要多种分辨率?

react-native - 如何使用 React-Native 进行这种转换?

react-native-navigation 抽屉没有打开

iphone - 为什么我在 4.2 模拟器中看不到某些 OpenGL ES 图表?

iphone - iOS 应用程序 : Uploading multiple files in the background

android - 在客户端处理发布状态