1

我的项目正在建设中。当我运行时,pod spec lint我收到以下错误:

 - ERROR | [MyApp/Core] [xcodebuild]  Target Support Files/Pods-MyApp/Pods-MyApp-prefix.pch:6:9: fatal error: 'MyConstants.h' file not found

值得注意的是常量文件的位置:Project/Classes/MyConstants.h. 这是我的podspec

Pod::Spec.new do |spec|
  spec.name         = "AppName"
  spec.version      = "1.0"
  spec.summary      = "blah blah"
  spec.homepage     = "http://company.com/"
  spec.license      = 'Apache 2.0'
  spec.author       = { "me" => "me@company.com" }
  spec.source       = { :git => 'ssh://path', :tag => '1.0'}

  spec.requires_arc = true
  spec.ios.deployment_target = '7.0'
  spec.frameworks   = ['Foundation', 'UIKit', 'CoreGraphics', 'QuartzCore']

  spec.source_files = 'Classes/**.*', 'Classes/ViewControllers/**.*', 'Classes/Views/**.*'

  spec.prefix_header_contents = '#import "MyConstants.h"'

  spec.subspec 'Core' do |cs|
    cs.dependency 'libextobjc', '~> 0.4'
  end

end

我也试过换行:

spec.prefix_header_contents = '#import "MyConstants.h"'

和:

spec.prefix_header_file = 'MyApp/MyApp-Prefix.pch'

但结果是一样的。我应该怎么做才能启用前缀以查看源代码?

- - 编辑 - -

我已经重构了我所有的源文件。我已经手动导入了需要的类,没有使用前缀。因此,这个问题对我来说不再重要。

4

2 回答 2

0

您指定了spec.prefix_header_contents = '#import "MyConstants.h"' 要插入到文件中的代码行.pch,由pod安装过程中创建。如果您收到此错误,那是因为文件MyConstants.h丢失。

编辑 如果您的MyConstants.h文件是主要项目源,则无法从Pod.

于 2015-03-03T12:20:33.360 回答
0

我有同样的问题。最后我ss.public_header_files在我的subspec. 它更像是一项对我有用的工作(我不会称之为解决方案)。根据文档:

public_header_files

 A list of file patterns that should be used as public headers.    
These are the headers that will be exposed to the user’s project
and from which documentation will be generated. If no public
headers are   specified then all the headers are considered public.


也许它并不完全准确。

编辑
我的解决方案并不完全正确。当我使用它运行验证pod lib lint时,当我使用选项验证它时,它已成功构建,我再次spec收到相同的错误。我最终将问题写给了 cocaoPods 团队。.pch 无法识别包含的文件

于 2015-03-26T10:22:22.843 回答