美文网首页
项目集成Pod

项目集成Pod

作者: Theshy | 来源:发表于2016-07-13 00:24 被阅读85次
  • 首先创建项目
  • 终端中cd到当前项目
  • 执行pod init 此时项目中会多出一个Podfile的文件
    右键选择打开方式 选择xcode 或者直接拖拽Podfile文件到xcode
    不要选择文本编辑器打开,不然可能由于编码问题 后边pod命令中会出现警告
  • 打开后发现Podfile中已经生成了相应的代码
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'PodTest' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for PodTest

end

  • 若是自己选择touch 命令自己建的话 还有自己输入代码

  • # platform :ios, '9.0' 中的#去掉 (版本改到适配版本就好)

  • use_frameworks!这句代码在OC项目中会是注释状态,若是混编会报错 相应框架找不到 最后直接去掉#

  • 以集成ReactiveCocoa框架为例

    • 运行pod search ReactiveCocoa
    • 找到相应框架
    • 复制pod 'ReactiveCocoa', '~> 4.1.0' 粘贴在Podfile文件中 保存
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'

target 'PodTest' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for PodTest
  pod 'ReactiveCocoa', '~> 4.1.0'

end
  • 终端中运行pod install 结果如下
hideOnBush:PodTest Theshy$ pod install
Analyzing dependencies
Downloading dependencies
Installing ReactiveCocoa (4.1.0)
Installing Result (2.0.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `PodTest.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 2 total
pods installed.
hideOnBush:PodTest Theshy$ 

OK 安装成功

相关文章

网友评论

      本文标题:项目集成Pod

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