项目集成Pod

  • 首先创建项目
  • 终端中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 安装成功

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 12,253评论 4 61
  • 1、Pycharm中创建的flask项目,不能关联Jinja2模版的问题解决 通过pycharm创建jinja2模...
    枫灬叶阅读 1,043评论 0 1
  • 第一整整一年不离不弃的最佳饭友 第二没有文艺圣地我们简单的厦门 第三一张动车票我们走遍天南海北 第四腱子肉和海蛎煎...
    稣城阅读 201评论 0 1
  • 尖尖的手指刺破遥远晴空的那一层薄膜,那一瞬,云气萦绕十指,包裹如纸的柔软细腻的手掌,那一霎那的感触,是被拥抱、被呵...
    迷之仰望阅读 4,634评论 4 5