我已经将SpatialIite合并到一个Xcode项目中,该项目使用了来自projproject .4的头文件,只有一个头文件。两者都是Xcode项目,都有静态目标。

我试图从git子模块迁移到Cocoapods。由于静态目标似乎很难与Cocoapods一起使用,我只想以通常的方式构建项目。我为项目4做了podspec。在为SpatialLite编写podfile后,我得到了警告:

[!] The target `SpatialiteIOS [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The target `SpatialiteIOS [Debug]` overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The target `SpatialiteIOS [Debug - Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The target `SpatialiteIOS [Debug - Release]` overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

我读了这个问题,但我对警告是什么意思以及我能做些什么来解决它一无所知。

另外一个问题是,当我单独打开工作区以及打开SpatiaLite项目时,两者都是针对Mac OSX 64的,而它应该是一个iOS项目。我的播客文件上写着“平台:ios”。


当前回答

当我运行pod安装时,我遇到了类似的问题,我看到了以下警告/错误(与CLANG_CXX_LIBRARY有关):

Cocoapods的错误/警告

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

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

修复

选择您的项目,以便您可以看到生成设置。 选择目标(目标下的AppName) 找到c++标准库(它可能在BOLD中-这意味着它被覆盖了)。 选择行(所以它是突出显示的蓝色),并按⌘+ DELETE(命令+退格)

行不应该是粗体,如果你运行pod安装警告/错误应该已经消失。


视觉教具

其他回答

如果Xcode在链接时报错,例如Library not found for -lPods,它不会检测隐式依赖:

进入“产品>编辑方案” 点击构建 添加Pods静态库 清理并重新建造

这在大多数情况下都是有效的:

转到你的目标构建设置->其他链接标志->双击。将$(inherited)添加到新行。

如果你对“…目标覆盖GCC_PREPROCESSOR_DEFINITIONS构建设置定义在…"然后你必须添加$(继承)到你的目标构建设置->预处理器宏

Xcode截图

Ankish Jain给出了对我有用的答案。这里是要做什么的截图,因为我花了一点时间来找出到底要做什么。

在我的情况下,我需要添加$(继承)到我的“其他链接器标志”,因为这是什么显示为覆盖终端。

对我来说问题出在我的目标测试上。我已经在我的主应用程序目标中有$(继承)标志。

我把它添加到MyAppTests其他链接器标志。之后,当我运行pod安装时,警告信息消失了。

当我将$(inherited)标记添加到有问题的文件(在本例中是LIBRARY_SEARCH_PATHS)时,它导致了架构arm64的未定义符号:“_swift_getTypeByMangledNameInContextInMetadataState”的另一个错误

改变以下工作,我能够构建:

>LIBRARY_SEARCH_PATHS = (
   "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
-  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", <--- Change this...
+  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.2/$(PLATFORM_NAME)\"", <--- to this
   "\"$(inherited)\"",
> );