1 . 在安装cocoapods 成功的基础上, 打开你的工程文件.并将pod初始化.
$ cd yourProjectPath
$ pod init
2 .打开podFile文件, 在文件中写入你想导入的第三方库.使用( pod + '第三方库名')
$ open -a Xcode Podfile
增加后的 Podfile
# Uncomment the next line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
# platform :ios, '9.0'
target 'xinjiang' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for xinjiang
target 'xinjiangTests' do
inherit! :search_paths
# Pods for testing
end
target 'xinjiangUITests' do
# Pods for testing
end
pod 'AFNetworking'
pod 'SDWebImage'
pod 'MJExtension'
pod 'CYLTabBarController'
pod 'MJRefresh'
pod 'Reachability' 网络判断
pod 'DZNEmptyDataSet'或pod 'LYEmptyView'空白页面数据占位
pod 'IQKeyboardManager'
pod 'Masonry'
pod 'SVProgressHUD'
pod 'MBProgressHUD'
pod 'SDCycleScrollView'//轮播图
end
3 . 将第三方库导入工程中.
$ pod install --verbose --no-repo-update
上面执行不成功加上这句代码source 'https://github.com/CocoaPods/Specs.git'
以上不行用下面使用清华镜像
https://mirror.tuna.tsinghua.edu.cn/help/CocoaPods/
$sudo gem install cocoapods
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
链接:https://www.jianshu.com/p/ff44a3639907
网友评论