cocopods使用

本文详细介绍了CocoaPods的安装、使用、更新、编译项目及删除操作。在使用过程中遇到的智能引号警告和目标构建设置冲突问题,提供了解决方案,包括删除缓存、修改编辑器设置、调整项目配置等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装

使用

1创建podfile

  1. pod init
  2. vim Podfile

2编辑podfile
用xcode打开

platform :ios, '7.0'
pod "AFNetworking", "~> 2.0"

更新

1更新版本:pod repo update

有时太老的gem版本,搜索不到最新SDK库

特殊情况下,由于网络或者别的原因,通过 CocoaPods 下载的文件可能会有问题。 这时候您可以删除 CocoaPods 的缓存(~/Library/Caches/CocoaPods/Pods/Release 目录),再次导入即可。

编译包含CocoPods类库的项目

使用pod update
用pod install可能失败
如果总是失败,那就删除pod重装

删除pod

https://www.jianshu.com/p/6568b582627b

debug

出现这种警告

Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

解决办法:不要使用文本编辑去编辑Podfile,使用Xcode编辑,或者使用终端敲命令去编辑。或者输入格式错误,没输入运行版本:$platform:ios, ‘9.0‘

1 [!] The Paopao [Debug] target overrides the PODS_ROOT 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 Paopao [Debug] target overrides the OTHER_LDFLAGS 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 `Paopao [Release]` target overrides the `PODS_ROOT` 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.

     [!] The `Paopao [Release]` target overrides the `OTHER_LDFLAGS` 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.
    产生此警告的原因是项目 Target 中的一些设置,CocoaPods 也做了默认的设置,如果两个设置结果不一致,就会造成问题。

我想要使用 CocoaPods 中的设置,分别在我的项目中定义PODS_ROOT 和 Other Linker Flags的地方,把他们的值用$(inherited)替换掉,进入终端,执行

  pod update

警告没了

我个人更喜欢一种简单粗暴的方法:

点击项目文件 project.xcodeproj,右键显示包内容,用文本编辑器打开project.pbxproj,删除OTHER_LDFLAGS的地方,保存,pod update,警告没了。。。。(注意:OTHER_LDFLAGS 有两个地方:debug和release)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值