iOS开发之CocoaPods的使用
你开发iOS的方式还是石器时代吗?在这个世界上并不是所有的软件开发人员都是码农。在这个世界上有很多的geek存在他们为这个语言的发展做出了很大的贡献。现在随着iOS开发者的曾多也就出现了iOS程序猿提供的依赖管理工具或者也可以叫中央代码仓库这个工具叫做Cocoapods。
iOS石器时代的开发方式
我们在iOS开发中会经常用到很多第三方的开源库,从而简便我们的开发 github上提供了非常多的库给我们使用。我们经常是这么去使用的首先下载下我们所需的库文件然后手动的添加到我们自己的工程文件里。这样做的缺点是你的这个库和版本控制失去了联系如果库升级你根本不知道。当然国内开发者很多都在用老版本的库。更本不知道库还有升级这么一说。要是你真心觉得第三方库没有更新的必要的话这篇blog你也就没有看下去的必要了。也有的人更新第三方库的方式是库更新了重新再做copy一遍。
CocoaPods的使用
CocoaPods是Objective-C项目中最好用的第三方依赖包管理工具.你要做的很简单只要安装好后在自己的iOS项目下面建立一个podfile配置文件,在里面协商你要那些库CocoaPods就会帮你搞定一切。
CocoaPods的安装和使用
好了废话就说这么多了下面我们进入正题CocoaPods是ruby gem所以安装起来会非常简单苹果自带ruby.首先你得ruby -v 和gem -v 去查看下你得版本如果低于2.0得话会安装得时候报错
安装
$ sudo gem install cocoapods
$ pod setup
这样就安装结束了。然后就可以使用了。
查找
你可以通过
pod search XXXX(来查找你所需要得库)
比如查找一个我们最常用得json库
~ pod search json
-> AFJSONPRequestOperation (1.0.0)
AFNetworking Extension for the JSONP format.
pod 'AFJSONPRequestOperation', '~> 1.0.0'
- Homepage: https://github.com/acerbetti/AFJSONPRequestOperation
- Source: https://github.com/acerbetti/AFJSONPRequestOperation.git
- Versions: 1.0.0 [master repo]
-> AFJSONRPCClient (0.4.0)
A JSON-RPC client build on AFNetworking.
pod 'AFJSONRPCClient', '~> 0.4.0'
- Homepage: https://github.com/AFNetworking/AFJSONRPCClient
- Source: https://github.com/AFNetworking/AFJSONRPCClient.git
- Versions: 0.4.0, 0.3.1, 0.3.0 [master repo]
-> AnyJSON (0.1.0)
Encode / Decode JSON by any means possible.
pod 'AnyJSON', '~> 0.1.0'
- Homepage: https://github.com/mattt/AnyJSON
- Source: https://github.com/mattt/AnyJSON.git
- Versions: 0.1.0, 0.0.1 [master repo]
-> ARSafeJSON (0.0.7)
ARSafeJSON is a small library that will strip all occurences of NSNull from a
JSON of any depth.
pod 'ARSafeJSON', '~> 0.0.7'
- Homepage: https://bitbucket.org/antoine_r/arsafejson
- Source: https://bitbucket.org/antoine_r/arsafejson.git
- Versions: 0.0.7, 0.0.3 [master repo]
-> Collection-JSON-ObjC (1.0.1)
Collection+JSON parser for Objective-C.
pod 'Collection-JSON-ObjC', '~> 1.0.1'
- Homepage: https://github.com/chrissearle/Collection-JSON-ObjC
- Source: https://github.com/chrissearle/Collection-JSON-ObjC.git
- Versions: 1.0.1 [master repo]
-> FXJSON (1.1)
Lightweight, ARC-friendly JSON library, supporting both DOM and SAX style
parsing.
pod 'FXJSON', '~> 1.1'
- Homepage: https://github.com/nicklockwood/FXJSON
- Source: https://github.com/nicklockwood/FXJSON.git
- Versions: 1.1 [master repo]
-> GDJson (0.3.0)
J2ObjC implementation of GWT Elemental JSON library.
pod 'GDJson', '~> 0.3.0'
- Homepage: https://github.com/goodow/realtime
- Source: https://github.com/goodow/GDJson.git
- Versions: 0.3.0 [master repo]
-> jsoncpp (0.6.0.rc2)
jsoncpp is an implementation of a JSON (http://json.org) reader and writer in
C++.
pod 'jsoncpp', '~> 0.6.0.rc2'
- Homepage: http://jsoncpp.sourceforge.net/
- Source: https://svn.code.sf.net/p/jsoncpp/code/tags/jsoncpp/0.6.0-rc2/
- Versions: 0.6.0.rc2 [master repo]
-> JSONJoy (0.0.2)
Makes JSON a joy to use
pod 'JSONJoy', '~> 0.0.2'
- Homepage: https://github.com/daltoniam/JSONJoy
- Source: https://github.com/daltoniam/JSONJoy.git
- Versions: 0.0.2, 0.0.1 [master repo]
-> JSONKit (1.5pre)
A Very High Performance Objective-C JSON Library.
pod 'JSONKit', '~> 1.5pre'
- Homepage: https://github.com/johnezang/JSONKit
- Source: https://github.com/johnezang/JSONKit.git
- Versions: 1.5pre, 1.4 [master repo]
-> JsonLite (1.1.0)
High performance and low memory footprint JSON parser for mobile/embedded
systems
pod 'JsonLite', '~> 1.1.0'
- Homepage: https://github.com/amamchur/jsonlite
- Source: https://github.com/amamchur/jsonlite.git
- Versions: 1.1.0 [master repo]
-> JSONModel (0.10.0)
Magical Data Modelling Framework for JSON. Create rapidly powerful, atomic
and smart data model classes.
pod 'JSONModel', '~> 0.10.0'
- Homepage: http://www.jsonmodel.com
- Source: https://github.com/icanzilb/JSONModel.git
- Versions: 0.10.0, 0.9.3, 0.9.2, 0.9.1, 0.9.0, 0.8.4, 0.8.2, 0.8.1 [master
repo]
-> JSONSyntaxHighlight (1.0.0)
Add syntax highlighting to JSON objects in Objective C for both Cocoa and iOS
without using HTML.
pod 'JSONSyntaxHighlight', '~> 1.0.0'
- Homepage: https://github.com/bahamas10/JSONSyntaxHighlight
- Source: https://github.com/bahamas10/JSONSyntaxHighlight.git
- Versions: 1.0.0 [master repo]
-> MTJSONDictionary (0.0.4)
An NSDictionary category for when you're working with it converting to/from
JSON. DEPRECATED, use MTJSONUtils instead.
pod 'MTJSONDictionary', '~> 0.0.4'
- Homepage: https://github.com/mysterioustrousers/MTJSONDictionary.git
- Source: https://github.com/mysterioustrousers/MTJSONDictionary.git
- Versions: 0.0.4, 0.0.3, 0.0.2 [master repo]
-> MTJSONUtils (0.1.1)
An NSObject category for working with JSON.
pod 'MTJSONUtils', '~> 0.1.1'
- Homepage: https://github.com/mysterioustrousers/MTJSONUtils.git
- Source: https://github.com/mysterioustrousers/MTJSONUtils.git
- Versions: 0.1.1, 0.1.0, 0.0.1 [master repo]
-> PKJSONSocket (0.0.3)
Simplified socket networking based on CocoaAsynSocket. Enabling direct JSON
messaging between devices.
pod 'PKJSONSocket', '~> 0.0.3'
- Homepage: https://github.com/pkluz/PKJSONSocket
- Source: https://github.com/pkluz/PKJSONSocket.git
- Versions: 0.0.3, 0.0.2, 0.0.1 [master repo]
-> RDHJSONObjectSerialisation (0.5.0)
Simple JSON serialisation for any custom NSObject based on its declared
properties.
pod 'RDHJSONObjectSerialisation', '~> 0.5.0'
- Homepage: https://github.com/rhodgkins/RDHJSONObjectSerialisation
- Source: https://github.com/rhodgkins/RDHJSONObjectSerialisation.git
- Versions: 0.5.0 [master repo]
-> SBJson (3.2)
This library implements strict JSON parsing and generation in Objective-C.
pod 'SBJson', '~> 3.2'
- Homepage: http://stig.github.com/json-framework/
- Source: https://github.com/stig/json-framework.git
- Versions: 3.2, 3.1.1, 3.1, 3.0.4, 2.2.3 [master repo]
-> SDJSONPrettyPrint (0.0.1)
Produces human-friendly JSON, which you can use for logging or debugging
purposes.
pod 'SDJSONPrettyPrint', '~> 0.0.1'
- Homepage: https://github.com/tyrone-sudeium/SDJSONPrettyPrint
- Source: https://github.com/tyrone-sudeium/SDJSONPrettyPrint.git
- Versions: 0.0.1 [master repo]
-> SEJSONViewController (0.1.0)
Easily browse JSON content.
pod 'SEJSONViewController', '~> 0.1.0'
- Homepage: https://github.com/SergioEstevao/SEJSONControllerView
- Source: https://github.com/SergioEstevao/SEJSONViewController.git
- Versions: 0.1.0 [master repo]
-> SVJsonSchemaValidator (0.0.7)
Simple JSON Validator for Objective-C.
pod 'SVJsonSchemaValidator', '~> 0.0.7'
- Homepage: https://bitbucket.org/nut_code_monkey/jsonschemavalidator
- Source:
https://nut_code_monkey@bitbucket.org/nut_code_monkey/jsonschemavalidator.git
- Versions: 0.0.7, 0.0.6, 0.0.4, 0.0.3, 0.0.2 [master repo]
-> TouchJSON (1.1)
A humane JSON Objective-C un-framework. (TouchJSON has been deprecated - see
README).
pod 'TouchJSON', '~> 1.1'
- Homepage: https://github.com/touchcode/
- Source: https://github.com/TouchCode/TouchJSON.git
- Versions: 1.1, 1.0 [master repo]
-> VeriJSON (0.1.1)
An Objective-C library for verifying JSON against a pattern-based schema.
pod 'VeriJSON', '~> 0.1.1'
- Homepage: https://bitbucket.org/dcutting/verijson
- Source: https://bitbucket.org/dcutting/verijson
- Versions: 0.1.1, 0.1.0 [master repo]
➜ ~
使用
首先通过终端进入工程文件建立podfile文件
touch Podfile
vim Podfile
然后你可以在podfile文件中添加你所需要的库的名称和版本
platform :ios, '6.0'
pod 'JSONKit', '~> 1.5pre'
wq!(保存退出)
然后在执行
pod install
注意 你每次更改完Podfile文件后都要执行pod install
做完这些后你就可以在你的工程目录下看见一个后缀为.xcworkspace你写项目打开这个就OK了。打开看以后会发现其实cocoapods做了一个事情就是他把第三方库都编译成了一个库文件。然后你的项目中去包含头文件,libPods.a被作为framework集成到目标项目。Pods.xcconfig 中配置了XCode编译的查找路径,通过这种方式将所有的第三方包来引入到项目中。
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
iOS开发之CocoaPods的使用的更多相关文章
- iOS开发之CocoaPods的安装与使用
前言部分 iOS开发时,项目中会引用许多第三方库,CocoaPods(https://github.com/CocoaPods/CocoaPods) 可以用来方便的统一管理这些第三方库. 一.安装 由 ...
- iOS开发之CocoaPods(objective-c第三方库管理工具)
介绍: iOS开发中,大多数情况下,我们都须要集成一些第三方依赖库.对于一个稍大的项目,用到的第三方依赖库的数量也很可观.CocoaPods是objective-c第三方库管理工具,方便第三方库的管理 ...
- 李洪强iOS开发之iOS好文章收集
李洪强iOS开发之iOS好文章收集 该文收集朋友们转发或自己的写的技术文章,如果你也有相关的好文章,欢迎留言,当好文章多的时候,我会对这些好文章进行分门别类 文章 简述 日期 直播服务配置 使用 ng ...
- iOS开发之Socket通信实战--Request请求数据包编码模块
实际上在iOS很多应用开发中,大部分用的网络通信都是http/https协议,除非有特殊的需求会用到Socket网络协议进行网络数 据传输,这时候在iOS客户端就需要很好的第三方CocoaAsyncS ...
- iOS开发之UISearchBar初探
iOS开发之UISearchBar初探 UISearchBar也是iOS开发常用控件之一,点进去看看里面的属性barStyle.text.placeholder等等.但是这些属性显然不足矣满足我们的开 ...
- iOS开发之UIImage等比缩放
iOS开发之UIImage等比缩放 评论功能真不错 评论开通后,果然有很多人吐槽.谢谢大家的支持和关爱,如果有做的不到的地方,还请海涵.毕竟我一个人的力量是有限的,我会尽自己最大的努力大家准备一些干货 ...
- iOS开发之 Xcode6 添加xib文件,去掉storyboard的hello world应用
iOS开发之 Xcode6.1创建仅xib文件,无storyboard的hello world应用 由于Xcode6之后,默认创建storyboard而非xib文件,而作为初学,了解xib的加载原理 ...
- iOS开发之loadView、viewDidLoad及viewDidUnload的关系
iOS开发之loadView.viewDidLoad及viewDidUnload的关系 iOS开发之loadView.viewDidLoad及viewDidUnload的关系 标题中所说的3个方 ...
- iOS开发之info.pist文件和.pch文件
iOS开发之info.pist文件和.pch文件 如果你是iOS开发初学者,不用过多的关注项目中各个文件的作用.因为iOS开发的学习路线起点不在这里,这些文件只会给你学习带来困扰. 打开一个项目,我们 ...
随机推荐
- EF里一对一、一对多、多对多关系的配置
EF关系规则 参考文章:http://www.cnblogs.com/feigao/p/4617442.html Entity Framework 实体间的关系,一对一,一对多,多对多,根据方向性来说 ...
- Linux 指令。
从16年11月21号开始吧,加班变得特别频繁,基本上一周加5天,周六也会加,下班也很晚,一般都是10点9点,回家之后很疲惫,已经很久没有给自己充过电了,自己的学习计划和健身计划也打乱了,对工作的压力也 ...
- JMS与MQ详解(有项目)
<一>m2mGW项目 1.ActiveMQ概述 企业消息软件从80年代起就存在,它不只是一种应用间消息传递风格,也是一种集成风格.因此,消息传递可以满足应用间的通知和互相操作.但是 ...
- [2]项目创建-使用C#.NET开发基于本地数据缓存的PC客户端
1.新建项目->已安装->模板->Visual c#->Windows桌面->Windows窗体应用程序,截图如下: 图中1:输入项目名称-“MoneyNotes”,图中 ...
- KSImageNamed 安装后无效解决方法
UIImage的imageNamed提供文件名自动补全功能.使用[UIImage imageNamed:@"xxx"]时,该插件会扫描整个workspace中的图片文件.若安装后无 ...
- oracle 报警日志详解
oracle报警日志是一个非常重要的日志,其有两种实现方法: 1.通过全局表来实现,这种方法有一种缺点,就是在关闭数据库后或者数据库宕机后就不能在使用了 2.通过外部表来实现,这种方法避免了方法一种的 ...
- BZOJ 1801中国象棋 DP
1801: [Ahoi2009]chess 中国象棋 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 1426 Solved: 826[Submit][ ...
- 一次失败的Selenium chromedriver切换
背景 Selenium webdriver一直使用Firefox作为浏览器来跑webtest, 但是最近发现ff有时会报超时的错误,于是想到使用chromedriver来提升稳定性.本想只把.fire ...
- Python之路,day8-Python基础
***面向对象的好处*** 更容易扩展.提高代码使用效率,使你的代码组织性更强,更清晰 更适合复杂项目的开发 封装 把功能的实现细节封装起来,只暴露调用接口 继承 多态 接口继承 定义 类----&g ...
- WPF 重新启动该程序
// Restart current process Method 1 System.Windows.Forms.Application.Restart(); Application.Current. ...