• iOS中如何使cocoapods管理第三方库


    首先要进行Ruby环境搭建:  

    具体可以参考一下连接:

    http://blog.csdn.net/showhilllee/article/details/38398119

    cocoapods基本的使用方法:

    1.搜索第三方库在pods下支持的版本

    例如项目中要是有AFNetWorking

     在终端中输入 pod search AFNetWorking,可以查看到AFNetWorking最新的版本。

    2.具体使用方法:

     >cd 到当前项目路径,

     >执行 vim Podfile,创建Podfile文件,

     >按i键进入编辑模式,输入

    platform :ios, '7.0'

    pod 'AFNetWorking', '2.3.0'

     >输入完成之后,先按 esc 退出编辑模式,输入 :wq   按enter键保存退出。

     >最后执行 pod install,把第三方库下载到项目中。

    cocoapods配置完成之后,以后就直接使用 xxx.xcworkspace 编辑代码。

    后期使用中会遇到这个问题: 

    Updating local specs repositories

    Analyzing dependencies

    [!] The dependency `FMDB (~> 2.3)` is not used in any concrete target.

    The dependency `SDWebImage (~> 3.6)` is not used in any concrete target.

    The dependency `AFNetworking (~> 2.3.0)` is not used in any concrete target.

    The dependency `DACircularProgress (~> 2.2.0)` is not used in any concrete target.

    The dependency `MBProgressHUD (~> 0.8)` is not used in any concrete target.

    The dependency `PSTCollectionView (~> 1.2.1)` is not used in any concrete target.

    The dependency `HPGrowingTextView (~> 1.1)` is not used in any concrete target.

    The dependency `ProtocolBuffers (= 1.9.3)` is not used in any concrete target.

    The dependency `leveldb-library (~> 1.18.1)` is not used in any concrete target.

    The dependency `SCLAlertView-Objective-C (~> 0.7.5)` is not used in any concrete target.

    The dependency `MWPhotoBrowser (~> 1.4.1)` is not used in any concrete target.

    The dependency `MMMarkdown (~> 0.5)` is not used in any concrete target.

     

     

    解决方法:

    官网是这样给推荐的:

    在创建Podfile的时候,用这种格式使用,


    platform :ios, '8.0'

    #use_frameworks!个别需要用到它,比如reactiveCocoa


    target 'MyApp' do

    pod 'AFNetworking', '~> 2.6'

    pod 'ORStackView', '~> 3.0'

    pod 'SwiftyJSON', '~> 2.3'

    end


    然后终端  $ pod install  运行就可以了

    里面的 MyApp 记得替换为自己攻城里面的target。这样就基本OK了,执行pod install / pod update 就都可以了。(use_frameworks! 这个是个别需要的,这里修改一下,可以把我上面的代码中的这一行【删除】)

     

  • 相关阅读:
    NULL、nil、Nil、NSNull的区别
    URL中有中文字符,转码方法
    iOS极光推送 点击推送消息跳转页面
    iOS中响应者链条-触摸事件
    WKWebKit基础
    iOS开发之详解正则表达式
    iOS中正则表达式的三种使用方式
    VS下载Github的项目引用报错
    RabbitMQ环境搭建
    ASP.NET Core之NLog使用
  • 原文地址:https://www.cnblogs.com/Crazy-ZY/p/5403600.html
Copyright © 2020-2023  润新知