关于上传组件的相关步骤和问题

2018-05-30  本文已影响0人  印象苹果

背景

最近公司准备让做一些日常开发常用的组件,然后看了一些知识和文章总结了一下防止以后忘记

概要

对索引库和代码库的分析

平常我们在开发中经常使用cocopod,明白了cocopod的工作原理也就进本明白了索引库和代码库的概念
cocopod 是怎样帮助我们下载代码的呢?

以'AFNetworking'为例
以我们自己创建代码仓库“SLSpecs”为例

公司公共库的创建步骤

  s.name         = "libBPush"
  s.version      = "0.0.1"
  s.summary      = "赛雷测试"
  s.description  = "赛雷代码测试"
  s.homepage     = "https://gitee.com/appleimpression/SLCode.git"
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'liwenquan' => '1145821676@qq.com' }
  s.source       = { :git => "https://gitee.com/appleimpression/SLCode.git", :tag => "#{s.version}" }

s.ios.deployment_target = '8.0'
s.source_files = 'class/*.{h,m}'
  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
  # s.vendored_libraries = 'upstream/*.a'
end

spec中添加静态库的依赖

Xnip2018-05-30_17-01-45.png

组件化资源资源的解决

关于xib
关于图片
生成framework

上传代码过程中遇到的问题

对podSpec 文件进行解读

Pod::Spec.new do |s|
  s.name         = "libBPush"
  s.version      = "0.0.1"
  s.summary      = "赛雷测试"
  s.description  = "赛雷代码测试"
  s.homepage     = "https://gitee.com/appleimpression/SLCode.git"
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'liwenquan' => '1145821676@qq.com' }
  s.source       = { :git => "https://gitee.com/appleimpression/SLCode.git", :tag => "#{s.version}" }

s.ios.deployment_target = '8.0'
s.source_files = 'class/*.{h,m}'
  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = "Foundation",'UIKit', 'MapKit'
  # s.vendored_libraries = 'upstream/*.a'
  # s.dependency 'AFNetworking', '~> 2.3'
  # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/CommonCrypto" }
end

对.spec中的文件进行说明

关于版本的迭代

组件库的使用

# Uncomment the next line to define a global platform for your project
 platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
source 'git@git.saileikeji.com:root/SLSpecs.git'


target 'testspec' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
   pod 'md5', '~> 0.0.1'
  # Pods for testspec

  target 'testspecTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'testspecUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

注意事项

上传cocopod

上一篇下一篇

猜你喜欢

热点阅读