//本文章是建立在以成功安装的cocopods的基础上;若没有安装请参考http://www.jianshu.com/p/071d30a3af02
使用cocopods查看第三方框架的使用的版本号:在终端里面直接输入`pod search 第三方框架的名称`。
==========常用的一些最新版本第三方库的一些信息:
1.低版本:导入第三方库
//网络数据处理:上传服务器,下载,网络请求,网络判断
platform :ios, '9.0'
pod 'AFNetworking', "~> 3.0"
//图片的缓存处理和优化
platform :ios, '9.0'
pod 'SDWebImage', "~> 3.0"
//数据库的一些处理
platform :ios, '9.0'
pod 'FMDB', '~> 2.6.2'
//伟大的菊花转,各种可以自定义的弹窗提示
platform :ios, '9.0'
pod 'MBProgressHUD', '~> 1.0.0
2.高版本:导入第三方库
//注意导入这些第三方库现在是这种模式:JZDetailStock为自己工程名
platform :ios, '8.0'
target 'JZDetailStock' do
pod 'AFNetworking', '~> 3.0'
pod'Masonry', '~> 1.0.0'
end
注意现在导入第三方库都使用高版本的方式:否则会报错(参考三常见的错误)
一.开始坑点的讲解了--新建工程工程中使用的导入第三库的指令
1.首先第一步cd +项目的文件路径+回车

回车后出现的页面:

2.输入:vim Podfile+回车
输入指令:vim Podfile+回车

按回车后出现:输入i进入到编辑模式。输入以下的第三方库

============进入编辑页面后的坑,终于来了
输入完成之后:首先按esc键后;在安shift+冒号键;开始输入wq或者 x都行

成功之后的页面:

3.最后一步:
输入pod install

成功后:

4.注意事项(容易出现问题)
编辑vim的编辑页面:首先按esc键后;在安shift+冒号键;开始输入wq或者 x都行
二、使用工程过程中使用的指令
命令行设置:1)cd+工程名 2)open podfile 3)pod search 第三方框架 4)commond+s 5)pod install --no-repo-updata
1.编辑打开podfile文件,输入需要导入库的第三方库信息

2.从product中选择install pods

3.等待几秒中(主要看网速)--成功的信息

三.常见的问题处理
3.1处理版本间的一些问题

低版本:
platform :ios, '8.0'
pod 'MBProgressHUD', '~> 0.9.2'
高版本:
platform :ios, '8.0'
target "targetName" do
pod 'MBProgressHUD', '~> 0.9.2'
end
注意:这里的 targetName 填写工程的名字。
注意:这里全部写成高版本即可
3.2自己建立了一个空的文件夹(没有建立工程)

处理方法:删除这个空工程,重新建立一个工程,再按照上面知识点讲解一步步来即可。
四、最新版本的cocoPods的问题处理(新版本标准的写法)
1、Unable to find a target named ' ';

解决方法:Podfile的工程文件和建立工程名不一致。名字改为一致即可

2、syntax error ,unexpected end-of-input,expecting keyword_end

解决方法:(标准的podfile的写法)

网友评论