pod help-->查看pod命令的帮助
pod search --> Search for pods(搜索pod)
pod trunk --> Interact with the CocoaPods API (e.g. publishing new specs) 上传source到trunk
pod spec --> Manage pod specs//管理pod spec
pod install -->Install project dependencies according to versions from a Podfile.lock //安装项目中的依赖项目
pod update -->Update outdated project dependencies and create new Podfile.lock//跟新依赖项目并且更新Podfile.lock
pod init -->Generate a Podfile for the current directory//创建pod file文件
复制代码
//注GKFramework.podspec是你的框架名称
pod spec create GKFramework.podspec
复制代码
然后编辑podspec文件。如下GKFramework.podspec
Pod::Spec.new do |s|
s.name = "GKFramework" //定义名称
s.version = "0.0.5" //tag版本
s.summary = "A Sample.so you can use it" //简介,以后search到简介
s.description = <<-DESC
this is gk framework, use it fortest your framework. we can use it as framework.
DESC
//s.description 定义具体的描述
s.homepage = "https://github.com/wongstar/GKFramework"
s.license = { :type => "MIT", :file => "LICENSE" }//具体license
s.author = { "wongstar" => "wongstar.iac@gmail.com" }
s.platform = :ios, "8.0"//build的平台
s.ios.deployment_target = "7.0"//最低开发
s.source = { :git => "https://github.com/wongstar/GKFramework.git", :tag => "#{s.version}" }
s.source_files = 'Classes/**/*'#s.public_header_files='GKFramework/Classes/**/*.h'
end
复制代码
s.description = <<-DESC
this is gk framework, use it fortest your framework. we can use it as framework.
DESC
s.description定义了描述该pod是用来做什么的。注意这里的写法
复制代码
source file没找到
[iOS] file patterns: The source_files pattern did not match any file.
确保你的source file是否配置正确,如你的spec目录和source对应的关系
cocoapods环境问题
unknown: Encountered an unknown error (Simulator iPhone 4s is not available.) during validation
执行下面命令
sudo gem install cocoapods --pre
复制代码
如果执行上面的有问题出现
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
执行下面命令
sudo gem install -n /usr/local/bin cocoapods
复制代码
Swift 版本问题
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a .swift-version file to set the version for your Pod. For example to use Swift 2.3, run:
echo"2.3" > .swift-version.
复制代码
验证失败,会出现一系列错误,但也不是无根可寻,其中出现错误频率最多的提示是
source files没找到
ERROR | [iOS] file patterns: The source_files pattern did not match any file.
pod search GKFramework 搜索不到
Unable to find a pod with name, author, summary, or description matching GKFramework.
解决办法:
1.pod install --repo-update
2.或者全部删除:使用命令:rm ~/Library/Caches/CocoaPods/search_index.json
重新search GKFramework