首先电脑上面要安装了CocoaPods
然后打开终端 "cd 主项目地址"

输入下面的语句,来编辑Podfile文件
vim Podfile

然后再回车到这里面了(下面有两种方式可以编辑这个文件,1.用终端2.直接到项目的文件夹里面去)

01.用终端来编辑(编辑完成的时候按 esc退出编辑,再:wq保存并退出;按了esc后想要继续编辑就按 i 键,完成了就:wq 保存退出)
下面红线里面的就是模拟添加的几个库,后期可以根据需要在后面据需添加。


当你打开文件夹再打开下面这个文件后发现里面跟你编辑的一样一样的。


02.那么第二个办法就出来了,直接找到上面的文件夹,把下面的代码粘贴进去就行了:
inhibit_all_warnings!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "8.0"
use_frameworks!
def pods
pod 'MJExtension'
pod 'MJRefresh'
end
target 'NewDemo' do
pods
end
常用的几个类库:
pod 'ReactiveCocoa', '~> 2.5'
pod 'YYKit'
pod 'AFNetworking'
pod 'MJExtension'
pod 'MJRefresh'
pod 'FDStackView'
pod 'TZImagePickerController'
pod 'Masonry'
pod 'MLLabel'
pod 'RongCloudIM', '~> 2.8.3'
pod 'SDAutoLayout'
pod 'LCProgressHUD'
pod 'DVSwitch'
pod 'MLEmojiLabel'
pod 'HCSStarRatingView'
pod 'UMengSocialCOM' #友盟分享
pod 'UMengAnalytics' #标准SDK,含IDFA 统计分析
pod 'UMengMessage-NO-IDFA-SUN' #友盟推送
pod 'AMap3DMap' #3D地图SDK
pod 'AMapSearch' #搜索服务SDK
pod 'AMapLocation' #定位SDK
pod 'IQKeyboardManager'
添加完成之后记得保存下来。
然后就该pod install 安装第三方库了 一两个比较快,要是多的时候需要耐心的等待了。


完成后会发现工程里面多了好多的文件夹:(以后打开就不用上面那个工程打开了,用下面的这个打开)

打开后工程就是这样,你需要的第三库都封装好了放在那里,等着你享用了。

网友评论