老项目使用 CocoaPods 遇到的 install 问题

Android 目前开发中常使用 Gradle 管理依赖,久闻 iOS 使用 CocoaPods 管理依赖。

使用 CocoaPods 方便使用第三库时的管理、更新、配置。

因老项目使用 SDWebImage 加载和缓存图片,但是是直接将源代码复制进项目的做法,今天在修改代码时,想一步一步将项目的第三方库通过 CocoaPods 来管理依赖。

#Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'

target 'demo' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for demo
  pod 'SDWebImage', '~>3.8'

  target 'demoTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

执行 pod install 时,遇到了如下错误:

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

......

开始以为这只是普通警告而已,选择了无视;导入 #import <SDWebImage/UIImageView+WebCache.h> Xcode 也能正确跳转到对应代码,但编译会报该文件 not found

网上搜索一番,找到CocoaPods报错问题,照着操作,

但很神奇,一确认参数就不见了,再点开参数又在里面,不管了,将文章中对应的三处都修改,执行 install,还是报一样的错误 😂😂😂

又搜索一番,找到CocoaPods 错误 target overrides the OTHER_LDFLAGS...,照着操作,pod install 执行成功,但 Xcode 编译报其它文件 not found 😱😱😱

终端提示明明是

- Use the `$(inherited)` flag, or

而且网上很多问题也是加此代码,很费解 🤔🤔🤔

关键来了,解决办法

PROJECT
TARGETS

原来在 Xcode7 有两处 Build Settings,需要在 TARGETS 下的 Build Settings 修改才生效;

install 完,将项目的里的 SDWebImage 源代码删除,运行成功💤

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容