Podspec模式包括未在source_files中列出的头文件

时间:2018-10-26 18:58:17

标签: objective-c swift cocoapods

我正在尝试创建一个Cocoapod。但是当我运行pod lib lint时,出现以下错误:

MyCoolProject (1.0.0)
    - ERROR | [iOS] public_header_files: The pattern includes header files that are not listed in source_files 

然后列出所有我的.h文件。 (为简便起见,删除了一些

/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProject.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProjectConstants.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProjectEnums.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProjectMacros.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProject_.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/UIView+MyCoolProjectPrivate.h, 
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/UIViewController+MyCoolProject.h

我花了2天的时间,发现0条信息可以帮助我理解和纠正错误。 有人可以告诉我我可能做错了什么吗?

这是我的podspec文件

Pod::Spec.new do |s|
  s.name                = "MyCoolProject"
  s.version             = "1.0.0"
  s.summary             = "Color Framework for iOS (Obj-C & Swift)"
  s.homepage            = "https://github.com/myusername/MyCoolProject"

  s.license             = { :type => "MIT", :file => "LICENSE.md" }
  s.author              = "My Name"

  s.platform            = :ios
  s.ios.deployment_target = '8.0'
  s.source              = { :git => "https://github.com/myusername/MyCoolProject.git", 
                            :tag => s.version.to_s }

  s.public_header_files = 'Pod/Classes/Objective-C/**/*.h'
  s.frameworks   = 'UIKit', 'QuartzCore', 'CoreGraphics'

  s.default_subspecs = 'Default'

  s.subspec 'Default' do |ss|
    ss.source_files = 'Pod/Classes/Objective-C/**/*.{h,m}'
  end

  s.subspec 'Swift' do |ss|
      ss.ios.deployment_target = '8.0'
      ss.source_files = 'Pod/Classes/Swift/MyCoolProjectShorthand.swift'
      ss.dependency 'MyCoolProject/Default'
  end
end

从我的屏幕快照中可以看到,所有文件都在那里:

enter image description here

1 个答案:

答案 0 :(得分:0)

public_header_files声明移到Default子规范中会有所不同吗?还是将source_files移到外部范围?

我怀疑CocoaPods在处理其依赖项之前正在检查Swift子规范的文件。