3、代码导入
cd 到 Example 文件下,然后pod install,更新 Example 项目的 pod
打开 Example 项目,Pod 下的 Development Pods 文件夹就是私有库代码 四、podspec 文件配置 1、修改 podspec 文件
语法参考网站:https://guides.cocoapods.org/syntax/podspec.html
podspec 文件注释
Pod::Spec.new do |s|
# 项目名称
s.name = 'ZFPodProject'
# 版本号
s.version = '0.1.0'
# 项目摘要
s.summary = 'A short description of GOOCR.'
# 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
GOOCR的项目描述,这是G1项目个人私有库
DESC
# 主页,这里要填写可以访问到的地址,不然验证不通过
s.homepage = 'https://www.baidu.com'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
# 作者
s.author = { 'Zephyr' => '2049982764@qq.com' }
# 项目地址,这里不建议使用ssh地址,会有警告,建议使用http和https,最好是https
# 更改成自己的项目远程仓库地址
s.source = { :git => 'https://gitee.com/ZF_AloneOwl/zfpod-project.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '11.0'
# 源码
s.source_files = 'ZFPodProject/Classes/**/*'
# 资源文件
s.resource_bundles = {
'ZFPodProject' => [
'ZFPodProject/Assets/*.png',
'ZFPodProject/Assets/*.ttf'
]
}
# swift 版本
s.swift_versions=['5']
# s.frameworks和s.dependency根据是否有依赖库来决定是否需要添加
# 依赖的frameworks
s.frameworks = 'UIKit', 'AVKit', 'Foundation'
# 依赖的公开库或私有库,如有多个,可以重复声明
s.dependency 'Alamofire','~> 5.2.2'
s.dependency 'Moya','~> 14.0.0'
end
.cocoapods 属于隐藏文件夹 Mac 显示隐藏文件夹快捷键:command + shift + .
使用 pod search ZFPodProject 进行搜索,结果如下就表示 ZFPodProject 可以正常使用了
pod search xxx 报错
Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --version 1.12.2
Creating search index for spec repo 'ZFSpec'.. Done!
[!] CDN: trunk - Cannot perform full-text search because Algolia returned an error: 0: Cannot reach any host: execution expired, execution expired, execution expired, execution expired
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
inhibit_all_warnings!
# 私有源
source 'https://gitee.com/ZF_AloneOwl/zfspec.git'
# 若还需要使用其他三方库,如 Moya 等,需要指定一个共有源
source 'https://gitee.com/mirrors/CocoaPods-Specs.git'
target 'PodDemo' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'ZFPodProject'
pod 'Moya'
end
参考文章:
CocoaPods搭建私有库
CocoaPods使用
pod install无响应等CDN: trunk - Cannot perform full-text search because Algolia returned an error: 0: Ca