赞
踩
CocoaPods Specs 源地址:原始仓库-github、镜像仓库-gitee
- source 'https://github.com/CocoaPods/Specs.git' # 原始仓库
-
- source 'https://gitee.com/mirrors/CocoaPods-Specs.git' # 镜像仓库(每日同步一次)
查看 CocoaPods 的 repos 与 Caches
- ~/.cocoapods/repos/ # repos
-
- ~/Library/Caches/CocoaPods/ # Caches
- pod install --repo-update # 更新本地repo,并pod install
-
- pod install --no-repo-update # pod install,不更新repo
-
- pod repo update # 默认更新所有repo
-
- pod repo update ~/.cocoapods/repos/master # 更新指定repo
-
- pod search YYKit # 查询YYKit的相关Specs信息
Podfile 中添加私有库的 source、pod 配置,在终端输入 pod install 构建
- source 'https://github.com/zhengmiaokai/Specs.git'
-
- pod 'JPUtils', '~> 1.0.0'
在 Podfile 中使用 post_install 自定义 pod 库的 Build Settings
- post_install do |installer|
- installer.pods_project.targets.each do |target|
- if target.name == 'JPUtils'
- target.build_configurations.each do |config|
- config.build_settings['CODE_SIGN_IDENTITY'] = ""
- end
- end
- end
- end
name:私有库包名
s.name = 'JPUtils'
version:当前版本号
s.version = '1.0.1'
platform:最低支持系统
s.platform = :ios, '8.0'
source:源码git地址、标签
- s.source = { :git => 'git地址', :tag => 'JPUtils_1.0.1' }
- #等价于:s.source = { 'git' => 'git地址', 'tag' => 'JPUtils_1.0.1' }
requires_arc:是否为arc
s.requires_arc = true
source_files:代码源文件路劲
- s.source_files = 'JPUtils/utils/required/*.{h.m}', 'JPUtils/utils/optional/*.{h.m}'
-
- s.source_files = 'JPUtils/utils/**/*.{h.m}'
public_header_files:公共头文件路径(默认值:source_files配置的头文件)
s.public_header_files = 'JPUtils/public/header/*.h'
libraries:系统libs
- s.libraries = 'sqlite3', 'stdc++'
- #等价于:s.libraries = ['sqlite3', 'stdc++']
vendored_libraries:内置libs路径
- s.vendored_libraries = 'JPUtils/utils/required/tool.a', 'JPUtils/utils/optional/common.a'
-
- s.vendored_libraries = 'JPUtils/utils/**/*.a'
resources: 资源文件地址
- s.resources = 'JPUtils/utils/resource.bundle'
-
- s.resources = 'JPUtils/utils/*.bundle'
frameworks:系统frameworks
s.frameworks = ['UIKit', 'Foundation']
vendored_frameworks:内置frameworks路径
- s.vendored_frameworks = 'JPUtils/utils/required/tool.framework', 'JPUtils/utils/optional/common.framework'
-
- s.vendored_frameworks = 'JPUtils/utils/**/*.framework'
dependency:关联第三方库、组件库,s.dependency 'MKNetwork', '~> 1.0.2'(版本号在Podfile中声明,避免多个podspec出现不一致的情况)
- s.dependency 'AFNetworking'
- s.dependency 'MKNetwork'
valid_archs:当前私有库支持的处理器
- valid_archs = ['x86_64', 'arm64e', 'arm64', 'armv7s', 'armv7']
-
- # arm64e:iPHone XS,iPHone XR,iPhone 11, ...
- # arm64:iPhone5s,iPhone6、7、8,iPhone6、7、8 Plus,iPhone X,...
- # armv7s:iPhone5, iPhone5C,iPad4,...
- # armv7:iPhone 3GS,iPhone4,iPhone 4s,iPad,iPad2,iPad3,...
pod_target_xcconfig:当前私有库的Build Settings配置
- s.pod_target_xcconfig = { :OTHER_LDFLAGS => '-lObjC',
- :CLANG_CXX_LANGUAGE_STANDARD => 'c++11',
- :CLANG_CXX_LIBRARY => 'libc++',
- :VALID_ARCHS => 'x86_64 arm64e arm64 armv7s armv7' }
-
- # :OTHER_LDFLAGS等价于'OTHER_LDFLAGS'
- # :VALID_ARCHS等价于'VALID_ARCHS'
user_target_xcconfig: pod库的Build Settings配置
- s.user_target_xcconfig = { 'OTHER_LDFLAGS' => '-lObjC',
- 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11',
- 'CLANG_CXX_LIBRARY' => 'libc++',
- 'VALID_ARCHS' => 'x86_64 arm64e arm64 armv7s armv7' }
-
- # user_target_xcconfig:对工程中所有 pod 的设置
- # pod_target_xcconfig:对当前 pod 的设置
- # 如果多个 pod 的 podspec 中对 user_target_xcconfig 同⼀个值进行了设置,会存在冲突的问题
subspec :pod子模块配置
- s.subspec 'catogerys' do |ss|
- ss.source_files = "component/catogerys/**/*.{h,m}"
- ss.dependency "JPUtils"
- end
-
- s.subspec 'controllers' do |ss|
- ss.source_files = "component/controllers/**/*.{h,m}", "component/utils/**/*.{h,m}"
- ss.dependency "component/catogerys"
- end
备注:文件路径中 * 表示文件名通配符, ** 表示文件夹递归匹配;数组用逗号隔开(如: s.libraries = 'a', 'b' 或者 s.libraries = ['a', 'b'] )
https://github.com/zhengmiaokai/Specs.git
- pod repo add zhengmiaokai https://github.com/zhengmiaokai/Specs.git
-
- pod repo remove zhengmiaokai # 移除repo
pod spec lint ~/desktop/zhengmiaokai/JPUtils/JPUtils.podspec --use-libraries --allow-warnings --verbose --sources='私有库-git地址,CocoaPods-git地址'
pod spec lint ~/desktop/zhengmiaokai/JPUtils/JPUtils.podspec --use-libraries --allow-warnings --verbose --sources='https://github.com/CocoaPods/Specs.git,https://github.com/zhengmiaokai/Specs.git'
pod repo push zhengmiaokai ~/desktop/zhengmiaokai/JPUtils/JPUtils.podspec --use-libraries --allow-warnings --verbose --sources='私有库-git地址,CocoaPods-git地址'
pod repo push zhengmiaokai ~/desktop/zhengmiaokai/JPUtils/JPUtils.podspec --use-libraries --allow-warnings --verbose --sources='https://github.com/CocoaPods/Specs.git,https://github.com/zhengmiaokai/Specs.git'
备注:--use-libraries (使用libraries和frameworks)、--allow-warnings(忽略警告)、--verbose(定位错误)--sources='specs地址'(默认为CocoaPods,多个地址用逗号隔开)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。