先做记录之用
1.更新cocoapods至最新版本
$sudo gem install cocoa pods
2.注册邮箱,xxxx为git用户名
pod trunk register 123456@qq.com 'xxxx' --verbose
3.查看注册信息
pod trunk me
4.创建 .spec文件
pod spec create ViewController
5.编辑文件ViewController.spec
vim ViewController.podspec
//下面是文件内容
Pod::Spec.new do |s|
s.name = 'xxxxxxx'
s.version = '1.0.1'
s.license = 'MIT'
s.summary = 'A view like UIAlertViewController on iOS.'
s.homepage = 'https://github.com/xxxxx/ViewControllerController'
s.authors = { 'xxxxx' => '123456@qq.com' }
s.source = { :git => 'https://github.com/xxxxx/ViewControllerController.git', :tag => s.version.to_s }
s.requires_arc = true
s.ios.deployment_target = '7.0'
s.source_files = 'ViewControllerController/*.{h,m}'
end
6.验证xxxxx.spec文件编写是否正确
pod lib lint ViewController.podspec
7.推送到github
git tag '1.0.1'
git push --tags
8.把编写的文件告诉Cocoapods
pod trunk push viewController.podspec
[注意事项]
1.pod setup卡住问题
执行
$ git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
[!] Unable to satisfy the following requirements:
- `AFNetworking (~> 2.3.1)` required by `Podfile`
Specs satisfying the `AFNetworking (~> 2.3.1)` dependency were found, but they required a higher minimum deployment target.
解决方案:Podfile 文件 中 platform:ios, ‘8.0’ 后边的 8.0 是平台版本号 ,一定要加上
网友评论