美文网首页
Podfile语法

Podfile语法

作者: toro宇 | 来源:发表于2020-02-14 12:40 被阅读0次

1.单个target依赖库

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'targetName1' do 
pod 'MJRefresh', '~> 1.4.6' 
pod 'Masonry', '~> 0.6.1'
end

2.多个target依赖库

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'targetName1' do 
  pod 'MJRefresh', '~> 1.4.6' 
  pod 'Masonry', '~> 0.6.1'
endtarget '

target 'Name2' do 
  pod 'MJRefresh', '~> 1.4.6' 
  pod 'Masonry', '~> 0.6.1' 
  pod 'AFNetworking', '~> 3.0'
end

3.多个target依赖库高端写法

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
# ruby语法: 如果有新的target直接加入该数组
targetsArray = ['targetName1', 'targetName2', 'targetName3', 'targetName4', 'targetName5']
# 循环
targetsArray.each do |t| 
  target t do 
    pod 'MJRefresh', '~> 1.4.6' 
    pod 'Masonry', '~> 0.6.1' 
  end
end

注意:
(1) platform : 和 ios之间不能有空格,否则报pod语法错误
(2)podfile中的注释使用#号,不能使用//,否则报错
(3)Podfile错误写法展示:


image.png

相关文章

  • CocoaPods的Podfile文件编写

    一、Podfile文件? 二、Podfile语法参考 Podfile Syntax Reference官网 1)永...

  • Podfile语法

    1.单个target依赖库 2.多个target依赖库 3.多个target依赖库高端写法 注意: (1) pla...

  • Podfile 语法

    Podfile 是描述一个或多个 Xcode 项目的目标的依赖关系的规范。Podfile文件可以非常简单: 一个更...

  • Podfile语法

    1.单个target依赖库 2.多个target依赖库 3.多个target依赖库高端写法 注意:(1) plat...

  • Podfile语法

    https://guides.cocoapods.org/syntax/podfile.html#podfile[...

  • CocoaPods之Podfile\Podfile.lock

    什么是Podfile ? CocoaPods是用ruby实现的,因此Podfile文件的语法就是ruby的语法。p...

  • CocosPod 语法

    source ‘URL’ : 指定镜像仓库的源 具体的Podfile的语法和用法见文档:Podfile 语法规范P...

  • Podfile语法参考

    1.官方说明:点击这里2.翻译请看简书:这里

  • CocoaPods Podfile 语法

    Podfile 文件 CocoaPods 是通过 Podfile 文件来管理依赖库的,该文件在项目根目录下,如果没...

  • [iOS] Podfile 多 target 的配置

    使用 ruby语法 相关文章 你真的会写Podfile吗?

网友评论

      本文标题:Podfile语法

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