您的位置 首页 > 腾讯云社区

【iOS】将代码上传到pod创库---MapleYe

1、利用pod创建项目pod lib create PPKit

这时候的生成工程目录为

目录

编写podspec文件

# # Be sure to run `pod lib lint PPKit.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'PPKit' s.version = '0.0.1' s.summary = 'A short description of PPKit.' # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? # * Try to keep it short, snappy and to the point. # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! s.description = <<-DESC TODO: Add long description of the pod here. DESC s.homepage = 'https://github.com/maple1994/PPKit' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'maple1994' => '305554601@qq.com' } s.source = { :git => 'https://github.com/maple1994/PPKit.git', :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' s.ios.deployment_target = '8.0' s.source_files = 'PPKit/Classes/**/*' # s.resource_bundles = { # 'PPKit' => ['PPKit/Assets/*.png'] # } # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' # s.dependency 'AFNetworking', '~> 2.3' end

可以看到我们指定source_files指定在PPKit/Classes文件夹下的所有文件,所以我们的源码都放在这里就可以了

2、上传代码到pod

podspec文件编辑好后,我们就可以上传该文件到pod上了,进入podspec同级目

pod trunk push

如果之前没有注册pod账号的,先注册/登录也是执行以下指令

pod trunk register 305554601@qq.com 'maple'3、私有库

私有库跟公有库最大的区别就是,podspec的文件摆放位置。如果podspec文件都上传到github上的 https://github.com/CocoaPods/Specs,所以如果我们想搭建私有库,我们也要在自己的仓库搭建一个专门存放specs文件的地方。那么我们上传spec文件的时候,就要添加仓库和推送指定的仓库

// 添加 pod repo repoName git@git.xxx.xxx:iOSPods // 推送 pod repo push repoName xxx.podspec

更详细的内容可以参考 http://www.cocoachina.com/articles/26210

---来自腾讯云社区的---MapleYe

关于作者: 瞎采新闻

这里可以显示个人介绍!这里可以显示个人介绍!

热门文章

留言与评论(共有 0 条评论)
   
验证码: