cocoaPods 打包静态库 遇到的坑
参考资料
iOS 打包.a文件的那些事儿
iOS-将自己的库支持CocoaPods
错误1
Cloning `https://github.com/CocoaPods/pod-template.git` into `PYScalableTableView`.
Configuring PYScalableTableView template.
/Users/lp1/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- colored2 (LoadError)
from /Users/lp1/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/lp1/Desktop/PYScalableTableView/PYScalableTableView/setup/TemplateConfigurator.rb:2:in `<top (required)>'
from ./configure:5:in `require_relative'
from ./configure:5:in `block in <main>'
from ./configure:4:in `each'
from ./configure:4:in `<main>'
To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `http://guides.cocoapods.org/making/making-a-cocoapod`.
解决方法
#查看当前ruby版本
ruby -v
#列出已知的ruby版本
rvm list known
#安装ruby 2.4.0
rvm install 2.4.0
错误2. Swift Language Version” (SWIFT_VERSION) is required ...
“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
打开项目,pod中搜索**SWIFT_VERSION**,把所有的第三方库的Swift Language Version 都变成Swift3
打开工程配置目录,一样的操作
错误3、pod lib lint xxx.podspec命令出错打包出错**
用这个命令
pod lib lint --use-libraries --allow-warnings --verbose
错误4、[!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.
这个错误是因为你没有打开邮箱中发给你的网址,如果想重新发送请执行下面代码
pod trunk register XXX@163.com XXXX
错误5、swift_version: The validator for Swift projects。。。。
- WARN | [iOS] swift_version: 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
这个是关于pod版本设置问题请运行下面代码
echo "3.0" > .swift-version