cocopods 的使用

作者: 齐滇大圣 | 来源:发表于2015-05-04 16:19 被阅读4721次

iOS开发~CocoaPods使用详细说明

选择版本###

pod 'AFNetworking', '~> 1.0'
版本号可以是1.0,可以是1.1,1.9,但必须小于2

pod 'AFNetworking', '1.0'
版本号指定为1.0

pod 'AFNetworking',
不指定版本号,任何版本都可以


一些命名###

  • pod setup

用于跟新本地电脑上的保存的Pods依赖库tree。由于每天有很多人会创建或者更新Pods依赖库,这条命令执行的时候会相当慢,还请耐心等待。我们需要经常执行这条命令,否则有新的Pods依赖库的时候执行pod search命令是搜不出来的。


遇到的一些问题:###

  • pod install还是pod update都卡在Analyzing dependencies不动了
    其实原因在于以上两个命令执行时会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:
    pod install --verbose --no-repo-update
    或者
    pod update --verbose --no-repo-update

  • Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add use_frameworks! to your Podfile or target to opt into using it.
    use_frameworks!

  • Unable to find a specification for 'xxxxx'

rm -rf ~/.cocoapods
pod setup
pod install

  • overrides the OTHER_LDFLAFS build setting defined in
    Pods/Pods.xcconfig

stackoverflow上的回答

Edit Scheme->Build->+>缺失的.a文件
或targets->build phases->link binary with libraries->+>缺失的.a文件

  • 更新到最新的cocoapods需要指定targets

use_frameworks!
#给所有target 添加pod
abstract_target ‘xxxx’ do
pod 'AFNetworking'

#下面是每个target单独添加pod.
target 'XXXX' do
pod 'AFNetworking'
end

参考

http://www.jianshu.com/p/6e5c0f78200a

相关文章

  • CocoPods使用

    本文献给初次使用CocoPods的童鞋们,以下代码可以直接复制使用 CocoPods安装前的终端配置 1.移除现有...

  • CocoPods的使用

    在进行iOS开发的过程中,需要用到很多的第三方开源类库,例如AFNetworking、YYModel、SDWebI...

  • cocopods的使用

    1、比如创建一个demo项目;2、终端cd 项目中: cd /**/ demo3、在终端输入 pod init4...

  • cocopods 的使用

    iOS开发~CocoaPods使用详细说明 选择版本### pod 'AFNetworking', '~> 1.0...

  • cocopods的使用

    安装 使用 Podfile配置 注意: pod install 和 pod update 的区别

  • cocopods 使用

  • cocopods使用

    vim Podfile 键盘输入 i,进入编辑模式,输入 platform :ios, '7.0' pod 'MB...

  • Cocopods使用

    Cocopods 在第一次pod install的时候会生成lock文件,lock文件是合作开发 统一所有导入的...

  • cocopods使用

    1.打开 mac终端 cd 到iOS已有项目,可以看到xx.xcodeproj等文件 2.vim podfile文...

  • CocoPods使用

    新建podfile cd 工程路径可以拖拽文件直接到终端 pod touchfile pod install 关闭...

网友评论

  • 陈霸先:非常感谢,Best wishes to u
  • 居然是村长:一部分需要 use_frameworks? 一部分不要。。有没有办法。
  • 齐滇大圣:@449009af1aad platform :ios, '8.0'

    pod 'Alamofire', '~> 1.1'
    pod 'Taplytics'
    pod 'MBProgressHUD'
    pod 'Atlas'

    use_frameworks!

    就是在加入你需要的那些库之后最后再加一句use_frameworks!
  • 449009af1aad:请问,Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add use_frameworks! to your Podfile or target to opt into using it.这个问题怎么解决啊
    Andy_WangPeng:@449009af1aad platform :ios, ‘9.0’
    use_frameworks!
    def pods
    pod 'Alamofire'
    end
    target '天气APP' do
    pods
    end

本文标题:cocopods 的使用

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