美文网首页iOS Developer移动开发ios之Cocoapods集合
更新CocoaPods版本及Podfile写法的改变

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

作者: zhifenx | 来源:发表于2016-11-15 11:51 被阅读281次

一、更新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:


终端执行指令:

pod install

即可完成!

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

相关文章

网友评论

    本文标题:更新CocoaPods版本及Podfile写法的改变

    本文链接:https://www.haomeiwen.com/subject/hjgkpttx.html