iOS-OC中级

Podfile 语法

2019-12-30  本文已影响0人  秀才不才
Podfile 是描述一个或多个 Xcode 项目的目标的依赖关系的规范。Podfile文件可以非常简单:
target 'MyApp'
pod 'AFNetworking', '~> 1.0'
一个更复杂的 Podfile 的例子可以是:
platform :ios, '9.0'
inhibit_all_warnings!

target 'MyApp' do
  pod 'ObjectiveSugar', '~> 0.5' //指定项目的依赖项。

  target 'MyAppTests' do
    inherit! :search_paths
    pod 'OCMock', '~> 2.0.1'
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    puts "#{target.name}"
  end
end
plugin

指定安装过程中应该使用的插件。

plugin 'cocoapods-keys', :keyring => 'Eidolon'
plugin 'slather'
pre_install

这个钩子允许你在 Pods 下载之后,但是在它们安装之前,对它们做任何改变。

pre_install do |installer|
  # Do something fancy!
end
post_install

此钩子允许您在将生成的 Xcodeproject 写入磁盘之前对其进行最后一次更改,或者执行您可能想要执行的任何其他任务。

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported'
    end
  end
end
上一篇 下一篇

猜你喜欢

热点阅读