2019独角兽企业重金招聘Python工程师标准>>>

CocoaPods is an open source library management tool for Objective-C (both iOS and OS X). This article is going to briefly take you through how to get started. This is meant t0 be a quick-fire demo – check out the Getting Started guide for more details.

A CocoaPod (singular) is a specification for a library, usually open source. CocoaPods (plural) is the tool for managing these specs.

First, you'll need to install CocoaPods. That's pretty easy since CocoaPods is a Ruby Gem, and all Macs ship with Ruby. Open a terminal and type the following (it'll ask you for your password):

sudo gem install cocoapods

That'll install CocoaPods on your machine.

Next, you'll need an Xcode project that you want to integrate. Use cd to navigate to the working directory of your app.

cd ~/Desktop/Demo

Next, type the following command:

pod init

This command creates an empty Podfile for you. Open it in a text editor. It'll look like the following.

# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"target "Demo" doendtarget "DemoTests" doend

Uncomment the second line to specify the platform (iOS) and the version (6). For your target (the first target), enter pod "SVProgressHUD", "0.9".

platform :ios, "6.0"target "Demo" dopod "SVProgressHUD", "0.9"endtarget "DemoTests" doend

Save the file and return to the text editor. Enter the following command.

pod install

This will produce the following output.

> pod install
Analyzing dependencies
Downloading dependencies
Installing SVProgressHUD (0.9)
Generating Pods project
Integrating client project[!] From now on use `Demo.xcworkspace`.

Follow the last line's instruction and close your Xcode project and open the Xcode Workspace file that's been created for you. An Xcode workspace is like a folder for Xcode projects. Your Pods project contains all of the libraries (pods).

Cool.

Now we need to import the SVProgressHUD.h header. Since it's in another Xcode project, make sure to use angle brackets.

#import <SVProgressHUD.h>

That's it! We can now use our library. We've successfully integrated CocoaPods into our project. For each library you want to use, write pod "POD_NAME", "POD_VERSION" in your Podfile and re-run pod install.

There's an Xcode plugin for CocoaPods if you're not into the command line.

I gave a talk this morning on effectively using open source software. The slides are below.

转载于:https://my.oschina.net/w11h22j33/blog/204456

Getting Started with CocoaPods相关推荐

  1. cocoapods更新

    使用sudo gem install cocoapods更新提示: ERROR: While executing gem ... (Errno::EPERM) Operation not permit ...

  2. cocoaPods安装、更新第三方库

    pod install 换成 pod install --verbose --no-repo-update pod update 换成 pod update --verbose --no-repo-u ...

  3. CocoaPods私有库搭建的记录

    前言 随着项目的业务增加以及马甲包进度的跟进,一些重复的独立业务以私有库的方式引入到项目中对于项目进度的开发就显得越发的迫切了,本文主要记录自己搭建私有库时的整个流程,以防后面再次搭建时忘记,方便自己 ...

  4. CocoaPods远程私有库

    上一篇(让自己的开源项目支持CocoaPods集成)介绍了将自己开发的框架代码发布到Cocoapods,全球的开发者都可以通过pod search搜索到我们的框架代码以及通过pod install进行 ...

  5. 让自己的开源项目支持CocoaPods集成

    平时我们会经常用CocoaPods集成第三方库,那如何使自己的代码也可以通过CocoaPods集成呢?只需要简单几步: 创建git仓库,把代码提交到Github或码云等 在git仓库中创建.Podsp ...

  6. 你真的会用 CocoaPods 吗?

    CocoaPods 可以说是 iOS 开发应用最广泛的包管理工具,本篇文章主要介绍 CocoaPods 的第三方库是怎样从网络集成到我们本地的项目当中,也是制作私有库.开源库和 iOS 项目组件化的一 ...

  7. 使用 CocoaPods 给微信集成 SDK 打印收发消息

    推荐序 本文介绍的是一套逆向工具,可以在非越狱手机上给任意应用增加插件.在文末的示例中,作者拿微信举例,展示出在微信中打印收发消息的功能. 这套工具可以加快逆向开发的速度,其重签名思想也可以用于二次分 ...

  8. CocoaPods原理(一)

    CocoaPods介绍 CocoaPods 是开发 OS X 和 iOS 应用程序的一个第三方库的依赖管理工具.利用 CocoaPods,可以定义自己的依赖关系 (称作 pods),并且随着时间的变化 ...

  9. 最新 macOS Sierra 10.12.3 安装CocoaPods及使用详解

    cocoapods官网:https://guides.cocoapods.org 一.什么是CocoaPods 每种语言发展到一个阶段,就会出现相应的依赖管理工具,例如 Java 语言的 Maven, ...

  10. CocoaPods导入的库其头文件导入的方法

    尽管CocoaPods使用十分方便,但其导入的第三方框架还是要经过几步操作,才能供项目使用; 第一步:导入库 1>-在终端进入项目的根目录; 2>-输入:touch Podfile,则项目 ...

最新文章

  1. android theme material,Android Studio 换主题(Material Theme..)
  2. 企业的覆灭,我监视你的Exchange邮件!
  3. 为什么平衡对游戏数值策划如此重要
  4. 初学Java--计算器
  5. 设计点击左侧切换页面进出_Axure教程:(初级)导航中的页面切换
  6. java(3) if结构
  7. centos7 设置ip地址
  8. [ActionScript 3.0] NetConnection建立客户端与服务器的双向连接
  9. 用于数据科学的Python库,命令行工具,Jenkins X,DevOps,Perl 6等
  10. python绘图颜色深浅代表数值_画图理解Python的深浅拷贝
  11. TF2.0-tf.keras.callbacks.ModelCheckpoint
  12. Notepad++使用心得和特色功能介绍
  13. 深度学习系列之Anchor based 和 Anchor free 目标检测方法
  14. Wed Sep 16 2020 00:00:00 GMT+0800 (中国标准时间)时间转换为mysql date类型
  15. 温故而知新(一)—— 再看RNN、LSTM、GRU
  16. 微信浏览器内打开App Store链接,并跳转到App指定安装页面
  17. Java基础:volatile详解
  18. Xtend官方文档-第一部分
  19. Java:集合类性能分析
  20. 5G驻留比提升经验总结

热门文章

  1. drm linux 内核,Linux内核DRM实现分析——基于i915
  2. pyecharts a python_python 可视化 | pyecharts基本使用
  3. oracle nodemanage,Linux 下Weblogic集群搭建-04通过nodemanage进行节点的启动与关闭
  4. 用c语言编程实现strcpy,用c语言.模拟实现strcpy,strcat,strcat,memcpy,memmove
  5. catia曲面扫掠命令详解_Catia曲面基础与工程实践 3.2 扫掠曲面
  6. 华为交换机SSH和telnet登录配置
  7. Python基础数据类型之set集合
  8. ue4场景没阴影_UE4 Mobile使用动态阴影的一些小结
  9. Python的XML解析!
  10. linux nginx搭配https