[英]Podspec: Prefix import not found
我的项目进展顺利。 当我运行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'
但是结果是一样的。 我应该怎么做才能启用前缀以查看源代码?
-编辑-
最后,我重构了所有源文件。 我已经导入了不需要使用前缀的手动类。 因此,这个问题对我而言不再重要。
使用spec.prefix_header_contents = '#import "MyConstants.h"'
您指定了一条代码行,以插入在安装过程中由pod
创建的.pch
文件中。 如果收到此错误,则是因为缺少MyConstants.h
文件。
编辑如果MyConstants.h
文件是主要项目源,则无法从Pod
访问它。
我有同样的问题。 最后,我在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无法识别包含的文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.