CocoaPods实践之制作篇

CocoaPods制作要点:
1、需要添加license类型,这里选择了MIT License。
2、.podspec文件内容参考

Pod::Spec.new do |s| s.name = "SJDropDownView" s.version = "1.0.0" s.summary = "A drop down view used on iOS." s.description = <<-DESC It is a drop down view used on iOS, which implement by Objective-C. DESC s.homepage = "https://github.com/shawjan" # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" s.license = 'MIT' s.author = { "shawjan" => "[email protected]" } s.source = { :git => "https://github.com/shawjan/SJDropDownView.git", :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/NAME' s.platform = :ios, '9.2' # s.ios.deployment_target = '5.0' # s.osx.deployment_target = '10.7' s.requires_arc = true s.source_files = 'SJDropDownView/*' # s.resources = 'Assets' # s.ios.exclude_files = 'Classes/osx' # s.osx.exclude_files = 'Classes/ios' # s.public_header_files = 'Classes/**/*.h' s.frameworks = 'Foundation', 'UIKit' end

遇到了一个小坑:

愣是盯了许久,终于发现<<-DESC 和DESC后面分别多了两个空格,所以说……
然而又遇到了一个问题:

s.homepage url 无效。然而我再浏览器能够打开!查了下,据说是个已修复的bug:Unify handling of redirects, etc. for validation of URLs,难道是我的CocoaPods很久没更新了?同时我也设置了公开库,不是私有库原因。 看完问题There was a problem validating the URL,只能归结为时好时坏的bug。不过我改了s.homepage url=https://github.com/shawjan,然后就通过了。
3、Fork Spec.git,并clone https://github.com/shawjan/Specs。但是老是出错:RPC failed; result=7, HTTP code = 0。看了答案,RPC failed; result=7, HTTP code = 0。这里总结一下:
git://和https://协议不同,https协议是由多少文件就请求多少次,git协议是打包传送,因此对于大项目来说,git开头的传输方式会比较稳定且快。
参考文章:《CocoaPods详解之—-制作篇》

你可能感兴趣的:(ios,CocoaPods,制作)