文章目录

  • Pod 命令
    • 1、CocoaPods版本查看
    • 2、安装升级CocoaPods
    • 3、创建Podfile
    • 4、添加第三方库(添加、更新、移除第三方库都用这个)
    • 5、查看第三方库信息
    • 6、查看项目组第三方库版本信息
  • 2、Podfile 设置
      • 2.1、关闭cocoapods中的第三方库的警告提示
    • 2.2、设置pod的buildsettings
  • 3、问题记录
    • 3.1 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
    • 3.2 镜像地址

Pod 命令

1、CocoaPods版本查看
pod --version
2、安装升级CocoaPods
sudo gem install cocoapods

如果报权限错误,执行以下命令

sudo gem install -n /usr/local/bin cocoapods
3、创建Podfile
$ vim Podfile
platform :ios, '9.0'target "CocoapodsDemo" dopod "AFNetworking"pod 'Masonry'
end

注:冒号和ios是连着的,中间没有空格,有空格会报错。

esc取消输入,:wq退出编辑

4、添加第三方库(添加、更新、移除第三方库都用这个)
pod install

添加后我遇到一下提示信息

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

解决方法:

在自己的项目的Target->build setting->搜索HEADER_SEARCH_PATHS,
在Header Search Paths中添加$(inherited);
搜索OTHER_LDFLAGS,在Other Linker Flags中添加$(inherited)

然后再执行 pod install,添加完成。

参考文章:CocoaPods的安装与使用

5、查看第三方库信息
pod search AFNetworking

5.1 pod search 报错

[!] CDN: trunk - Cannot perform full-text search because Algolia returned an error: 0: Cannot reach any host: execution expired, execution expired, execution expired, execution expired

解决方法
5.1.1 在Podfile中指定源地址

source 'https://github.com/CocoaPods/Specs.git'

5.2.2 移除trunk

pod repo remove trunk

再执行 pod search xxx 就可以了

6、查看项目组第三方库版本信息
cat Podfile.lock
PODS:- AFNetworking (3.2.1):- AFNetworking/NSURLSession (= 3.2.1)- AFNetworking/Reachability (= 3.2.1)// AFNetworking内容太多了,就显示一部分吧- Masonry (1.1.0)- MJRefresh (3.1.15.7)- Reachability (3.2)- YYCache (1.0.4)- YYModel (1.0.4)// 中间内容省略
COCOAPODS: 1.9.3

2、Podfile 设置

2.1、关闭cocoapods中的第三方库的警告提示
platform :ios, '9.0'
inhibit_all_warnings!

参考文章:iOS 开发去除 CocoaPods 警告(Fix Xcode Warning)

2.2、设置pod的buildsettings
...
target "xxxxxx" dopod 'xxxxx'......
end
post_install do |installer|installer.pods_project.targets.each do |target|target.build_configurations.each do |config|config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'config.build_settings['ENABLE_BITCODE'] = 'NO'endend
end

3、问题记录

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

解决方法:有问题的是CocoapodsDemo这个Target,在Build setting里搜索ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES,添加$(inherited)。debug和release都要添加。

参考:The XXXUITests [Debug] target overrides the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES build…

3.2 镜像地址

清华镜像
效果不太好,改用码云的镜像。

https://gitee.com/mirrors/CocoaPods-Specs.git

操作流程

$ cd ~/.cocoapods/repos
$ pod repo remove master
$ git clone https://gitee.com/mirrors/CocoaPods-Specs.git master

Podfile 源地址

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

因为trunk的原因会报

Found multiple specifications for `CocoaLumberjack (3.7.0)`:
- /Users/apple/.cocoapods/repos/master/Specs/d/1/8/CocoaLumberjack/3.7.0/CocoaLumberjack.podspec.json
- /Users/apple/.cocoapods/repos/trunk/Specs/d/1/8/CocoaLumberjack/3.7.0/CocoaLumberjack.podspec.json

移除trunk

pod repo remove trunk

CocoaPods使用笔记相关推荐

  1. python去重复字符串_python3取出重复3次的字符串保存为3列

    python3 取出重复 3 次的字符串保存为 3 列 .py python-IIS7.5-web.config-rewrite 规则转 .ht , 读取配置文件对比文件 MD5.py , 读取文件 ...

  2. CocoaPods私有库配置笔记

    本文转自:http://www.jianshu.com/p/4b63dfbd8be7 前情提要 公司项目一直在用CocoaPods管理第三方包,自己也想着将项目中的公用模块抽离出来独立的包.所以研究了 ...

  3. iOS 开发笔记 cocoapods 配置遇到的问题

    当使用svn的时候,每次使用pods update,都会出现一个问题,原来所有的第三方类库里面的.svn都被删除了.提交上svn服务器时,会要求提交全部.如果只是提交如MJExtension这个类库, ...

  4. 【iOS工具】rvm、Ruby环境和CocoaPods安装使用及相关报错问题解决(2016 12 15 更新)...

    〇.前言 在iOS开发中 [CocoaPods](https://github.com/CocoaPods/CocoaPods) 作为库依赖管理工具就是一把利器. 有了 CocoaPods 则无需再通 ...

  5. mqtt android简书,iOS MQTT协议笔记

    前言 接到任务项目需要用MQTT来写消息推送,经过一段时间在网上查看资料后写下这篇文章,文章内容大都来自互联网,在文章最后也会贴出相关网址和Demo.写这文章主要目的是自己总结下经验做下笔记,以便日后 ...

  6. xmpp整理笔记:xmppFramework框架的导入和介绍

    一个将要开发xmpp的项目,建议在项目刚创建就导入框架,这样可以避免一些自己操作失误造成不必要的损失. xmpp中最常用的框架就是 xmppFrameWork 往期回顾: xmpp整理笔记:环境的快速 ...

  7. iOS开发的学习笔记

    引言 之前做过半年的iOS开发,从完全不懂的移动开发的菜鸟,到完成前端UI开发的菜鸟,做的一些笔记,希望对大家有用,也希望这些总结的东西对以后会有作用. 开发环境 iOS的系统框架分为四个层次: 核心 ...

  8. cocoapods的安装使用

    本文非原创,只是看了别人的教程,自己做了下笔记 转载cocoapods其他详细教程 mac快速安装 由于天朝的那堵墙的阻挡,我们需要用taobao的镜像 以下操作在终端进行 gem sources - ...

  9. iOS App Clips学习笔记

    一.什么是App Clip? App Clip是一个App的轻量版,用来提供一些用户所需功能,我们可以把它看成苹果的小程序.它不需要下载就直接能打开.这样即可达到不下载完整版APP便可体验APP的部分 ...

最新文章

  1. 超详细的Guava RateLimiter限流原理解析
  2. R-CenterNet:用CenterNet对旋转目标进行检测
  3. python常用内置函数总结-python常用内置函数
  4. Linux--Sys_Read系统调用过程分析
  5. shell脚本启动kafka集群的多台节点
  6. 手机出货量暴跌!00后4年没换手机:除了贵、穷还有别的原因...
  7. java字符串替换 数组,Java工具类-拆分字符串组装数组,替换字符
  8. 计算机启动需输入两次密码,我的电脑开机的时候要输入2次密码,我应当怎么去除?...
  9. android判断密码字符串,逆向分析苏宁易购安卓客户端加密到解密获取明文密码(附demo验证) | WooYun...
  10. 云计算解决方案--百度文库
  11. 数据集_FashionMNIST 数据集
  12. 如何才能让自己成为一个自律的人?
  13. 苹果wifi网速慢怎么办_三步解决家里网速慢的问题
  14. paip.破解网站手机验证码
  15. cesium所有示例下载
  16. HDU 5869 Different GCD Subarray Query (数学gcd+树状数组离线查询)
  17. matlab双线性变换切比雪夫2,语音信号滤波去噪——使用双线性变换法设计切比雪夫II型.doc...
  18. 每日一词20190307——参考椭球体(reference spheroid)
  19. 浅入浅出keepalived+nginx实现高可用双机热备
  20. 个人总结对团队的贡献Android方面

热门文章

  1. Layui 实现rate评分点击后只读,动态rate控制只读,动态控制只读
  2. 计算机英语司爱侠第二版全文,计算机英语 第2版 配套习题 作者 司爱侠 张强华 参考试卷.doc...
  3. Cocopods在Mac ox 10.13报错
  4. 2021年9月 PYPL 全球编程语言流行度排行榜火热出炉
  5. java moco_moco入门
  6. uvex快速入门 Vue.js 应用程序开发的状态管理模式 + 库
  7. Gilde图片加载框架的使用
  8. 在线即时展现 Html、JS、CSS 编辑工具 - JSFiddle
  9. busybox移植到ARM开发板
  10. linux云同步文件夹,在Linux系统上备份Dropbox同步文件夹的方法