专业java、php、iOS、C++、网页设计、平面设计、网络营销、游戏开发、前端与移动开发培训机构

项目中使用到以下第三方框架

  • AFNetworking
  • SDWebImage
  • SVProgressHUD

Pod 安装 第三方框架

  • git 备份
  • 打开终端
  • $ cd 进入项目目录
  • 输入以下终端命令建立或编辑 Podfile

    // 创建 Podfile 文件
    1.在终端输入 pod init
    2.在Finder双击打开 Podfile
    
  • 设置 Podfile 内容

    # Uncomment this line to define a global platform for your project
    platform :ios, ‘8.0’
    target 'iOSWeibo12' do
    # Comment this line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!
    pod 'AFNetworking'
    pod 'SDWebImage'
    pod 'SVProgressHUD'
    end
    
  • 保存退出
  • 输入以下命令安装第三方框架
    $ pod install
    
  • 注意:
    • 不指定use_frameworks 会将所有第三方库打包成一个.a的静态库的
    • Swift 项目中,cocoapod 仅支持以 Framework 方式添加框架,因此需要在 Podfile 中添加 use_frameworks!
    • 如果网速慢只想用本地的库使用 pod install --no-reop-update
    • pod install 一个项目只需要一次,以后更改了只需要 pod update
  • 提交代码
  • 以后打开工程使用 项目名称.xcworkspace
  • 运行:看看添加框架是否有问题

results matching ""

    No results matching ""