cocoaPods結合高德地圖使用自動部署


高德官方自動部署(只有簡單的使用)http://lbs.amap.com/api/ios-sdk/guide/deploy/

開題“

注意:::下載什么類庫需要$ pod search AFNetworking(類庫名字)!!

 

偷懶:復制下面創建一個腳本直接進行安裝。或者復制到命令行粘貼。 

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

 

cocoaPods

 

一、cocoaPods簡介

類庫管理工具。主要用途就是更新項目中的類庫比較方便。

二、安裝

前置環境Ruby環境:

Ruby:一種腳本語言,特點是簡單快捷並面向對象。objective-c就是一種典型的簡單的面相對象語言。

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$

 

 

三、使用

$ 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$
四、更新類庫
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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM