iOS进阶之路

【iOS开发】为自己项目添加cocoaPod支持

2016-12-20  本文已影响41人  xiacheng

先来说自己遇到的问题:
一、podspec文件的修改
这里先贴出我写的。

#
#  Be sure to run `pod spec lint Calendar.podspec' to ensure this is a
#  valid spec and to remove all comments including this before submitting the spec.
#
#  To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |s|

s.name         = "Calendar"
s.version      = "0.0.1"
s.summary      = "a calendar for choosing time interval"
s.description  = <<-DESC
    A calendar which you can use to choose a time interval。
DESC
s.homepage     = "https://github.com/xiachengaa/Calendar"
s.license      = "MIT"
s.author       = { "xiacheng" => "157****2115@163.com" }
s.platform     = :ios
s.source       = { :git => "https://github.com/xiachengaa/Calendar.git", :tag => "0.0.1" }
s.source_files  = "CalendarViewController","CalendarViewController/*.{h,m}"
s.public_header_files = "CalendarViewController/CalendarViewController.h","CalendarViewController/CalendarView.h","CalendarViewController/CalendarDelegate.h"
s.requires_arc = true
end

问题1
我这里遇到一个问题,就是遇到了一个错误

- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- NOTE  | xcodebuild:  /Users/xiacheng/Library/Developer/Xcode/DerivedData/App-djztiyggzukltjcuzfyrmrdwrchd/Build/Products/Release-iphonesimulator/Calendar/Calendar.framework/Headers/CalendarViewController.h:10:9: fatal error: 'CalendarView.h' file not found
- NOTE  | xcodebuild:  /tmp/CocoaPods/Lint/App/main.m:3:9: fatal error: could not build module 'Calendar'

原来我的s.public_header_files 里面只写一个,后面加上import的header,就通过了,我现在也不知道s.public_header_files是什么意义,为什么会出这个错误???

问题2
这个是操作问题,我把本地的改好之后,没有同步到远程仓库就运行"pod lib lint" 来检测,结果当然是不行,自己还在想是那里出了问题。。。

更详细的可以[官网](http://guides.cocoapods.org/syntax/podspec.html 或者看这篇文章

参考文章:
iOS开发-- 创建podspec文件,为自己的项目添加pod支持
如何创建cocoapods能够导入的库
为自己的库添加 CocoaPods 支持
使用Cocoapods创建私有podspec

上一篇下一篇

猜你喜欢

热点阅读