更新CocoaPods版本及Podfile写法的改变

一、更新Cocoapods

1、查看CocoaPods的版本:

pod --version

2、升级CocoaPods:

sudo gem install cocoapods

此时可能报错:

ERROR:  While executing gem ... (Errno::EPERM) 
   Operation not permitted - /usr/bin/pod

3、如果报以上错误,请用下面指令升级:

sudo gem install -n/usr/local/bin cocoapods

4、最后执行

pod setup

耐心等待,安装成功!

二、导入第三方库(Podfile写法改变)

曾经:
Podfile文件内容:

pod ‘AFNetworking'

终端执行指令:

pod install

报错:

The dependency `` is not used in any concrete target

现在:
Podfile文件内容:

target ‘projectTarget' do
pod ‘AFNetworking’
end

projectTarget就是你项目的Target:

更新CocoaPods版本及Podfile写法的改变_第1张图片

终端执行指令:

pod install

即可完成!

参考链接:
CocoaPods详解之----使用篇
cocoa pod 需要指定target

你可能感兴趣的:(更新CocoaPods版本及Podfile写法的改变)