iOS开发资料收集区Cocoapods

iOS cocoaPods 创建私有库时podSpec的书写

2017-07-19  本文已影响332人  天明天

我们在进行iOS开发时早就习惯了使用cocoaPods来管理和使用第三方库,但是有的时候我们想自己创建类库供自己或者他人使用,这个时候podSpec的书写就变得尤为关键。这里主要是描述 podSpec如何书写,至于创建私有库的具体步骤以及踩过的坑你可以参考文章结尾的链接,非常详细。
podSpec的创建方法:

$ pod spec create VitamioSDK-iOS

这时候本地就生成一个VitamioSDK-iOS.podspec文件,或者去gitHub上拷贝一个podspec文件到自己项目目录下,改变下名字即可。

Pod::Spec.new do |s|

  s.name         = "VitamioSDK-iOS"
  s.version      = "1.0.1"
  s.summary      = "Vitamio SDK SDK for iOS"
  s.homepage     = "https://github.com/chenXming/VitamioSDK-iOS.git"
  s.license      = "MIT"
  s.author             = { "chenxiaoming" => "chenxiaoming@asean-go.com" }
  s.ios.deployment_target = "7.0"
 
  s.source        = {:git =>"https://github.com/chenXming/VitamioSDK-iOS.git", :tag =>'1.0.1'}

  s.source_files  = "Vitamio", "Vitamio/include/Vitamio/*.h"
  s.public_header_files = "Vitamio/include/Vitamio/*.h"
  s.vendored_libraries = "Vitamio/*.a"

  s.frameworks = "Foundation","UIKit","AVFoundation","AudioToolbox","CoreGraphics","CoreMedia","CoreVideo","MediaPlayer","OpenGLES","QuartzCore"

  s.libraries = "bz2", "z","stdc++","iconv"
  s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }

   s.requires_arc = true

常用字段说明:

上一篇下一篇

猜你喜欢

热点阅读