我如何告诉 Cocoapods 从当前目标继承 LIBRARY_SEARCH_PATHS?

How can I tell Cocoapods to inherit LIBRARY_SEARCH_PATHS from the current target?

在我的项目中,我们 link 针对一些我们保留在源代码控制下的二进制库。我们还使用 Cocoapod,它提供二进制形式的库。

在项目级别,我们指定本地图书馆的图书馆搜索路径。当我们将二进制 Cocoapod 添加到此目标时,生成的 xcconfig 文件设置了 LIBRARY_SEARCH_PATHS 配置变量,并与我们的项目设置冲突。我们看到这个警告:

[!] The `MyProject [Debug]` target overrides the `LIBRARY_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

我们的解决方法是将 Cocoapods 库的路径放在我们的目标搜索路径中,并让它覆盖来自 xcconfig 的路径。

为了避免覆盖,我们可以将 $(inherited) 标志放在 xcconfig 文件中,但这意味着我们需要将 xcconfig 放入源代码管理并在之后重置它运行 pod install.

有正确的方法吗?

我们可以在 Podfile 中设置一些东西来添加路径或 $(inherited) 标志吗?

感谢阅读!

您可以使用 post 安装挂钩插入您自己的静态库或框架,而不是通过 pods 安装。 https://guides.cocoapods.org/syntax/podfile.html#post_install