高德官方自动部署(只有简单的使用)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