高德官方自動部署(只有簡單的使用)http://lbs.amap.com/api/ios-sdk/guide/deploy/css
開題「ios
注意:::下載什麼類庫須要$ pod search AFNetworking(類庫名字)!!
git
偷懶:複製下面建立一個腳本直接進行安裝。或者複製到命令行粘貼。 github
sudo gem install cocoapods gem sources --remove https://rubygems.org/ echo '更改代理,有可能出錯,若是出錯暴力更改便可' gem sources -a http://ruby.taobao.org/ gem sources -l sudo gem install cocoapods
cocoaPodsobjective-c
1、cocoaPods簡介vim
類庫管理工具。主要用途就是更新項目中的類庫比較方便。api
2、安裝xcode
前置環境Ruby環境:ruby
Ruby:一種腳本語言,特色是簡單快捷並面向對象。objective-c就是一種典型的簡單的面相對象語言。app
Ruby安裝:
Madordie:~ KTJ$ gem sources --remove https://rubygems.org/ https://rubygems.org/ removed from sources Madordie:~KTJ $ gem sources -a https://ruby.taobao.org/
https://ruby.taobao.org/ added to sources Madordie:~ KTJ$ gem sources -l *** CURRENT SOURCES *** https://ruby.taobao.org/
cocoaPods安裝:
Madordie:~ KTJ$ sudo gem install cocoapods
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
Fetching: i18n-0.6.11.gem (100%)
此處省略兩千行。。。
Madordie:~ KTJ$
3、使用
$ pod search AFNetworking 在cocoaPods中搜索AFNetworking庫。若是支持則打印庫的相關信息。
組織更新規則,有點相似Makefile。。
命令進入項目目錄。
--------如下操做都是基於高德地圖的使用。----------------
注意:下面這條命令用來解決pod install 時候xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use xcode-select to change
Madordie:firstaMap KTJ$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer Password: Madordie:firstaMap KTJ$ Madordie:keith1408 KTJ$ cd amap-自動部署3D/ Madordie:amap-自動部署3D KTJ$ ls Podfile amap-自動部署3D.xcodeproj amap-自動部署3D amap-自動部署3DTests Madordie:amap-自動部署3D KTJ$ vim Podfile Madordie:amap-自動部署3D KTJ$ pod install Analyzing dependencies CocoaPods 0.35.0.rc1 is available. To update use: `gem install cocoapods --pre` [!] This is a test version we'd love you to try. For more information see http://blog.cocoapods.org and the CHANGELOG for this version http://git.io/BaH8pQ. [!] Unable to find a specification for `AMap333DMap` depended upon by Podfile. Madordie:amap-自動部署3D KTJ$ vim Podfile Madordie:amap-自動部署 KTJ$ ls JGShowMapViewController.h amap-自動部署 JGShowMapViewController.m amap-自動部署.xcodeproj Podfile amap-自動部署.xcworkspace Podfile.lock amap-自動部署Tests Pods Madordie:amap-自動部署 KTJ$ cat Podfile platform :ios, '7.0' pod 'AMap2DMap' pod 'AMapSearch' Madordie:amap-自動部署 KTJ$ cat ../amap-自動部署3D/Podfile platform :ios, '7.0' pod 'AMap3DMap' pod 'AMapSearch' Madordie:amap-自動部署 KTJ$ Madordie:amap-自動部署3D KTJ$ pod install Analyzing dependencies CocoaPods 0.35.0.rc1 is available. To update use: `gem install cocoapods --pre` [!] This is a test version we'd love you to try. For more information see http://blog.cocoapods.org and the CHANGELOG for this version http://git.io/BaH8pQ. Downloading dependencies Installing AMap3DMap (2.4.0) Installing AMapSearch (2.4.0) Generating Pods project Integrating client project [!] From now on use `amap-自動部署3D.xcworkspace`. [!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile: source 'https://github.com/CocoaPods/Specs.git' Madordie:amap-自動部署3D KTJ$ 4、更新類庫 Madordie:amap-自動部署3D KTJ$ pod update Update all pods Analyzing dependencies CocoaPods 0.35.0.rc1 is available. To update use: `gem install cocoapods --pre` [!] This is a test version we'd love you to try. For more information see http://blog.cocoapods.org and the CHANGELOG for this version http://git.io/BaH8pQ. Downloading dependencies Using AMap3DMap (2.4.0) Using AMapSearch (2.4.0) Generating Pods project Integrating client project [!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile: source 'https://github.com/CocoaPods/Specs.git' Madordie:amap-自動部署3D KTJ$
總結:
該類庫功能確實強大,而且一次搭建,永久使用。一行代碼搞定類庫更新添加神馬的。提升開發xiaol!
總結一下大體步驟:
搭建ruby環境。
安裝cocoaPods
根據需求編寫Podfile (該步驟比較重要)
安裝類庫
根據需求更新類庫
不要懼怕錯誤,看錯誤日誌,基本上學過英語的都OK