FRAMEWORK_SEARCH_PATHS 冲突
相信用过CocoaPod都会碰到下面这个问题:
[!] The `justTest [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-justTest/Pods-justTest.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
即FRAMEWORK_SEARCH_PATHS
,引发的冲突。
解决方案:
local.xcconfig 配置了 FRAMEWORK_SEARCH_PATHS
- local.xcconfig 需要在 FRAMEWORK_SEARCH_PATHS中添加
$(inherited)
就像这样
// 多个路径以空格分割
FRAMEWORK_SEARCH_PATHS = $(inherited) "${SRCROOT}/path/subpath"
- include podproject.xcconfig
// 这个路径就是上面`pod install` 运行后提示你的路径
#include "Pods/Target Support Files/Pods-justTest/Pods-justTest.debug.xcconfig"
local xcconfig 没有配置了 FRAMEWORK_SEARCH_PATHS
这个时候上面的方法,同样适用。但还可以采取另外一种方法: project --> target -> build settings -> FRAMEWORK_SEARCH_PATHS
添加$(inherited)
总结
两种方案,都必须增加 $(inherited)
选项 ,否则是不行的
如何确定xcconfig include path 有效
观察build log, 如果出现一下 **warning: unable to find included file "error path"**
屏幕快照 2019-04-09 下午3.52.36.png
则表明include path 不正确 ,仔细检查一下
解决 [CP] Check Pods Manifest.lock error
上述过程,有可能会出现下面的错误
diff: /../Podfile.lock: No such file or directory
diff: Manifest.lock: No such file or directory error:
The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
常用解决方案
rm -rf MyProject.xcworkspace
pod install
但这里并不适用,其实是因为找不到PODS_ROOT
PODS_ROOT
被定义在Pods/Target Support Files/Pods-justTest/'pod'.xcconfig 中,如果你找不到这个'pod'.xcconfig,就会报错。
'pod'. xcconfig
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/AppDynamicsAgent/iOSAgent-50.1.1610"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_LDFLAGS = $(inherited) -ObjC -l"sqlite3" -l"z" -framework "ADEUMInstrumentation" -framework "CoreTelephony" -framework "SystemConfiguration"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
// PODS_ROOT 在这里被定义,找不到这个文件,自然就找不到这个宏
PODS_ROOT = ${SRCROOT}/Pods
示例: Debug.xcconfig
//
// Debug.xcconfig
// BSTApp
//
// Created by 李腾芳 on 2018/6/1.
// 该路径出错,会出现上述错误
#include "Pods/Target Support Files/Pods-MyApp/Pods-MyApp.debug.xcconfig"
屏幕快照 2019-04-09 下午5.38.33.png
屏幕快照 2019-04-09 下午5.41.04.png
注意一下当前运行的是哪一个scheme, 以及当前scheme所配置的xcconfig,你有可能改错了xcconfig,或者运行了错误的configuration
网友评论