我已将 SpatialIite
合并到一个Xcode项目中,该项目使用 Proj.4
中的头文件,只有一个头文件 . 两者都是Xcode项目并具有静态目标 .
我正在尝试从git子模块迁移到Cocoapods . 由于静态目标似乎很难与Cocoapods一起使用,我只想以通常的方式构建项目 . 我为 Proj.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.
我读了this issue但我对这些警告意味着什么以及我能做些什么来修复它几乎一无所知 .
另外一个问题是,当我打开工作区以及单独打开SpatiaLite项目时,两者都是针对Mac OSX 64的,当它被认为是一个iOS项目时 . 我的podfile确实说“platform:ios” .
9 回答
这绝对适用于大部分时间:
转到目标构建设置 - >其他链接器标志 - >双击 . 将
$(inherited)
添加到新行 .如果您遇到“... target覆盖...中定义的GCC_PREPROCESSOR_DEFINITIONS构建设置”的问题,那么您必须将$(继承)添加到目标Build Settings - > Preprocessor Macros
您的构建设置与Cocoapods想要的默认构建设置之间存在冲突 . 要查看Cocoapods构建设置,请在项目中的Pods / Pods.xcconfig中查看该文件 . 对我来说这个文件包含:
如果您对Cocoapods设置感到满意,请转到项目的Build Settings,找到合适的设置并点击Delete键 . 这将使用Cocoapods的设置 .
另一方面,如果您需要使用自定义设置,则将$(继承)添加到该设置 .
我在终端中看到了pod命令的这3个错误
通过添加$(继承)来消除所有这3个错误
Headers 搜索路径
其他链接器标志
预处理器宏
在项目 - >目标 - >构建设置
现在命令将运行而不会出现任何错误
在项目中,找到
Target -> Build Settings -> Other Linker Flags
,选择Other Linker Flags
,按delete
(Mac键盘)/Backspace
(普通键盘)恢复设置 . 这个对我有用 .例:
之前
之后
当我运行
pod install
时遇到类似问题,我看到以下警告/错误(与CLANG_CXX_LIBRARY
相关):Cocoapods的错误/警告
修复
选择
Project
,这样就可以看到Build Settings
.选择
Target
(AppName
,Targets
下)查找
C++ Standard Library
(可能会在 BOLD 中 - 这意味着它已被覆盖) .选择直线(因此突出显示为蓝色),然后按⌘删除(命令退格)
该行不应再以粗体显示,如果您运行
pod install
,则警告/错误应该已消失 .视觉援助
如果Xcode在链接时抱怨,例如找不到-lPods的库,它不检测隐式依赖项:
转到产品>编辑方案单击构建添加Pods静态库清理并再次构建
下面的第一行链接节省了我的一天:
https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods#faq
另外,不要忘记在pod文件的开头插入此行:
对我来说,问题在于我的目标测试 . 我的主应用目标中已经有
$(inherited)
标志 .我将它添加到MyAppTests Other Linker标志中 . 之后,当我运行
pod install
时,警告消息消失了 .我添加了$(继承)但我的项目仍然没有编译 . 对我来说问题是标志“仅为活动架构构建”,我必须将其设置为YES .