iOS第三方库使用

时间 : 14-12-26 栏目 : iOS, 移动开发 作者 : noway 评论 : 0 点击 : 379 次

越来越多的SVN管理,越来越多的工程文件,我不能总是那么一个一个的把第三方库拖进去,我厌倦了拖拽和配置,我找到了替代方法–CocoaPods

英文好的可以直接读一下我参考的网页 http://www.raywenderlich.com/12139/introduction-to-cocoapods

不嫌我唠叨 我就自己慢慢敲

第一步:安装

CocoaPods是跑在Ruby的软件,安装可能需要几分钟,打开你的终端输入:

sudo gem install cocoapods

如果成功 会有一个 Successfully installed cocoaPods的提示 ,

然后输入

pod setup

如果显示Ruby环境不够新,你的机子就跟我的机子一样老,来升级吧

sudo gem update –system

好你的Ruby升级完了,可以重复之前的步骤了。

第二步:创建一个 Podfile 文件

继续在你的终端操作,先使用 cd 操作 进入你的项目目录例如 cd ~/desktop/HelloWord

在这个目录下创建文件

touch Podfile 然后回车继续输入
open -e Podfile 这时将直接打开一个空的文件先在这打开着不要管一会会处理的

第三步:搂一搂 搜索库

现在就需要找到你要的第三方库了,在终端里输入(以查找Reachability为例)

pod search Reachability

终端会有和这个搜索结果相近的选项(示例如下)

-> KSReachability (1.3)
A better iOS & Mac reachability for a modern age.
- Homepage: https://github.com/kstenerud/KSReachability
- Source: https://github.com/kstenerud/KSReachability.git
- Versions: 1.3, 1.1, 1.0, 0.0.1 [master repo]

-> NPReachability (0.1.0)
Reachability without the suck.
- Homepage: https://github.com/Abizern/NPReachability
- Source: https://github.com/Abizern/NPReachability.git
- Versions: 0.1.0 [master repo]

-> Reachability (3.1.0)
ARC and GCD Compatible Reachability Class for iOS and OS X. Drop in
replacement for Apple Reachability.
- Homepage: https://github.com/tonymillion/Reachability
- Source: https://github.com/tonymillion/Reachability.git
- Versions: 3.1.0, 3.0.0, 2.0.5 [master repo]

第四步:在刚才打开的空白Podfile中加入你想要的,如

platform :ios  (这表示应用平台)pod 'Reachability', '3.1.0'   (库的名称  库的版本号)
(如果是多个就继续罗列即可):
platform :ios
pod 'JSONKit','1.4'
pod 'Reachability','3.0.0'

第五步:将这个写入数据的 Podfile保存后关闭

第六步:在终端输入

pod install

然后终端会有显示 示例:

[!] From now on use `name.xcworkspace’.

最后:是的 就像你看到的,你打开工程需要双击 .xcworkspace 这个工程,而不是之前的xcodeproj!!

 

OK 就这样了

最近使用时发现 FMDB找不到,一看版本号 pod –version 0.16.4  好老的版本,然后升级下

就是重新装一下   sudo gem install cocoapods   等操作完成 重新显示一下版本号 0.19.1   OK FMDB也有了~

 

 

补充一下:最近在给新机子安装时 发现 sudo gem install cocoapods 没有反应,看来又是被墙了,可以翻墙操作,也可以用淘宝的ruby镜像

在终端敲入

$ gem sources --remove https://rubygems.org/

等有反应后再敲入

$ gem sources -a http://ruby.taobao.org/

然后测试下是真的可以了么,敲入
$ gem sources -l
*** CURRENT SOURCES ***

http://ruby.taobao.org/

恩 好了  继续之前的安装步骤  sudo gem install cocoaPods~~ 就可以了

 

How to build

  • 安装CocoaPods $ gem sources --remove https://rubygems.org/ $ gem sources -a http://ruby.taobao.org/ $ gem install cocoapods
  • 移除官方Pod源
    pod repo remove master
  • 添加项目内部Pod镜像
    pod repo add master https://coding.net/tanqisen/Specs.git
  • 安装依赖包
    pod install
  • 打开Keruyun.xcworkspace工程

本文标签

除非注明,文章均为( noway )原创,转载请保留链接: http://blog-old.z3a105.com/?p=380

iOS第三方库使用:等您坐沙发呢!

发表评论





       ==QQ:122320466==

 微信    QQ群


0

Aujourd’hui, une partie avec le développement du e-commerce, achats en ligne est devenu une partie de la vie pour beaucoup de gens. La mariage a commencé achats en ligne. Si vous choisissez achats les mariages en ligne, il peut être beaucoup moins cher que le salon de la Robe de mariée pas chermariée local, réduisant le budget de mariage. vous pouvez avoir beaucoup de choix si acheter de mariage en ligne. vous pouvez ramasser une robe de mariée bon marché sur Internet.
Piercing fascinerande figur, och nu tittar vi på 2016 senast brudklänning, kan du vara den vackraste bruden det!2016 senaste Bra brudklänning, söt temperament Bra design, romantiska spetsar blomma kjol, som du lägger till en elegant och charmig temperament.Kvinnan tillbaka mjuka linjer, människor brudklänningofta få en känsla av oändlig frestelse. Fall 2016 mässan, lämnar uppgifter om ditt bröllop charmig.
Yesterday afternoon, the Chinese team was training in the Guangzhou Gymnasium, when the reporter asked Zhao Yunlei the feeling of wearing the new cheap jersey , cheap jerseys online shopshe readily took a shirt from the bag crumpled ball to reporters, and she said with a smile: ” This shirt is light. ”Zhao Yunlei said: “Our material is very light like with the clothes of the tennis King Nadal, Federer, after the sweat, sweat does not drip down to the ground, when we do move, it is easy pace slipping if the sweat drip on the floor.”Tennis players Zhang Yawen, told reporters: “You might think the clothes attached to the body, fearing we swing will be affected, in fact, we do not feel anything, because the clothes are very light, very soft, put on quite comfortable. And it’s particularly good clothes to dry, washing and will dry in 15 minutes. ”
China’s sports enthusiasts NFL sweatshirt with mad love and the pursuit of, and therefore, NFL jerseys have a good market in China and development. China is a populous country, is the consumer, the economic momentum is so good, the sales prospects sportswear is immeasurable. With hot sales sweatshirt, but also to promote the importance of sports fans, on health, on the other hand is a matter of concern for the World Cup, fans wearing NFL jerseys and also can express themselves more fully love and obsession Therefore, NFL jerseys Wholesale jerseys online shopwholesale has good prospects and development in China.
ANTA-ANTA Sports Products Limited, referred to as ANTA Sports, Anta, is China’s leading sporting goods companies, mainly engaged in the design, development, manufacture and marketing of ANTA brand sporting goods, including sports footwear, apparel and accessories. Anta sweatshirt design advantages, warm stretch knit fabric, using Slim version of model, more personal fit, bid farewell to bloated, so wearing more stylish.GUIRENNIAO-This logo is a spiritual totem, smooth graphics implication unstoppable force; flexible deliver an elegant arc Wholesale jerseys china shop movement, strength and speed of the United States, a symbol of passion and rationality publicity “Heart” and “meaning”, “concept” unity; pass the fearless and enterprising mind, showing beyond the realm of self, to unstoppable force to create the future.XTEP-Xtep (China) Co., Ltd. is a comprehensive development wholesale jerseys china shop, production and marketing of Xtep brand (XTEP) sports shoes, clothing, bags, caps, balls, socks mainly large sporting goods industry enterprises.
There are a lot of fans in identifying the authenticity of the above cheap jerseys have great distress, so here to i will show you some methods to definitely affordable inexpensive cheap jerseys : Firstly, we should look at if it is working fine. China has been called the world’s factory, a lot cheap jerseys factories in China have foundries, but our cheap jerseys are all from here! Secondly, should to see whether it is the , we all know that it is difficult to get out of print once a genuine cheap cheap jerseys free shipping jersey was print. and we have all kind of stocka on the whole website, in other words, we have all you want ! Finally, look at the price, our price is not necessarily the lowest in the whole website but it must be most fair on the whole website, we certainly you will not regret later when you buy it. Of course, except that cheap jerseys, we also have the other products, such as socks, leggings and some other related products, everyone can enjoy the best services of here!

KUBET