0、gem 是用來管理我們終端下的很多應用程序,國外服務器,提供非常豐富的終端程序
1、修改源服務器 sudo gem sources -a https://ruby.taobao.org/ 或 http://rubygems-china.oss.aliyuncs.comsudo gem sources -r https://rubygems.org/ 移除源
2、安裝 cocoapods sudo gem install cocoapods 3、初始設置 pod setup //設置本地框架庫 (注意:該指令一般不好用,因此下載GitHub客戶端,fork下 cocoapods 的項目,然后使用客戶端克隆到本地目錄:~/.cocoapods),該成功率高。4、終端命令匯總 pod init //創建默認的Podfile pod install //第一次安裝框架使用 pod install -—no-repo-update //快速更新框架,而不更新本地索引,速度快 pod search XXXX (框架民,不區分大小寫) //搜索框架 pod —help //幫助(在項目文件夾下,在終端使用該命令) 安裝第三方框架時,只是第一次使用install ,之后就是直接使用Update,() 再次添加第三方框架時可以 直接pod ‘ 框架名’ 若不想再次使用該框架時,就在podfile中刪除,就可以 cocoaPods中的podfile介紹;如何指定版本號:1、一個簡單的podfile:pod 'AFNetworking', '~> 1.0' 版本號可以是1.0,可以是1.1,1.9,但必須小于22、-個更簡單的podfile:pod 'AFNetworking', '1.0' // 版本號指定為1.03、一個更更簡單的podfile:pod 'AFNetworking', // 不指定版本號,任何版本都可以版本詳細說明 Any version higher than 0.1 0.1以上(1)’>= 0.1' Version 0.1 and any higher version 0.1以上,包括0.1(2)’< 0.1' Any version lower than 0.1 0.1以下(3)’<= 0.1' Version 0.1 and any lower version 0.1以下,包括0.1(4)In addition to the logic Operators CocoaPods has an optimisic operator ~> :'~> 0.1.2' Version 0.1.2 and the versions up to 0.2, not including 0.2 and higher 0.2以下(不含0.2),0.1.2以上(含0.1.2)(5)’~> 0.1' Version 0.1 and the versions up to 1.0, not including 1.0 and higher 1.0以下(不含1.0),0.1以上(含0.1)(6)’~> 0' Version 0 and higher, this is basically the same as not having it. 0和以上,等于沒有此約束
新聞熱點
疑難解答