CocoaPods spec lint引发错误

我创建了一个iOS框架项目并为其添加了.podspec。 该框架生成良好以及包含的演示项目。 但是在pod spec lint测试中我收到了错误。

我正在使用的podspec文件是

Pod::Spec.new do |s|s.name         = "HorizontalPicker"
s.version      = "1.0.0"
s.summary      = "A similar to UIPickerView but horizontal picker view."
s.homepage     = "https://github.com/HHuckebein/HorizontalPicker"
s.license      = { :type => 'MIT', :file => 'LICENSE.txt' }
s.author       = { "RABE_IT Services" => "info@berndrabe.de" }
s.source       = { :git => "https://github.com/HHuckebein/HorizontalPicker.git", :tag => "1.0.0" }
s.platform     = :ios, '5.1'
s.source_files = 'HorizontalPicker/*.{h,m}'
s.framework    = 'QuartzCore'
s.requires_arc = true
end


-> HorizontalPicker (1.0.0)
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:42:30: error: unknown type name 'CAShapeLayer'
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:42:1: error: property with 'retain (or strong)' attribute must be of object type
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:63:16: error: property 'masksToBounds' cannot be found in forward class object 'CALayer'
- NOTE  | [xcodebuild]  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:82:75: note: forward declaration of class here
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:112:32: error: member reference base type 'int *' is not a structure or union
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:319:21: error: property 'borderColor' cannot be found in forward class object 'CALayer'
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:320:21: error: property 'borderWidth' cannot be found in forward class object 'CALayer'
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:340:33: error: property 'borderWidth' cannot be found in forward class object 'CALayer'
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:341:33: error: property 'borderColor' cannot be found in forward class object 'CALayer'
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:401:10: error: use of undeclared identifier 'CAGradientLayer'
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:410:3: error: unknown type name 'CAGradientLayer'; did you mean 'CGGradientRef'?
- NOTE  | [xcodebuild]  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGradient.h:8:28: note: 'CGGradientRef' declared here
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:410:37: error: use of undeclared identifier 'CAGradientLayer'; did you mean 'gradientLayer'?
- NOTE  | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:410:20: note: 'gradientLayer' declared here
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:410:54: error: expected expression
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:411:16: error: member reference base type 'CGGradientRef *' (aka 'struct CGGradient **') is not a structure or union
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:412:16: error: member reference base type 'CGGradientRef *' (aka 'struct CGGradient **') is not a structure or union
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:414:22: error: member reference base type 'CGGradientRef *' (aka 'struct CGGradient **') is not a structure or union
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:416:22: error: member reference base type 'CGGradientRef *' (aka 'struct CGGradient **') is not a structure or union
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:436:10: error: use of undeclared identifier 'CAGradientLayer'; did you mean 'gradientLayer'?
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:436:10: error: reference to local variable 'gradientLayer' declared in enclosing context
- ERROR | [xcodebuild]  HorizontalPicker/HorizontalPicker/HPickerView.m:436:10: error: bad receiver type 'CGGradientRef *' (aka 'struct CGGradient **')
- ERROR | [xcodebuild]  fatal error: too many errors emitted, stopping now [-ferror-limit=]

分析了1 podspec。

[!]规范没有通过验证。

编辑目录结构就像这样。 /Horizo​​ntalPicker/Horizo​​ntalPicker.podspec / Horizo​​ntalPicker / Horizo​​ntalPicker / Source Code居住在这里


看我发生了什么事

pod spec lint --no-clean ...

这会将生成的测试窗格留在/ tmp中。 所以我发现QuartzCore被添加到了pch文件中,这对于一个普通的项目来说是可以的,但是不能在类文件中。

所以它不是最好的编码风格。


在我的情况下,lint正在测试针对OS X SDK而不是iOS SDK的规范。

两个平台都有安全框架,但API不尽相同,因此也是错误。

只需将s.platform = :ios添加到podspec就可以修复它。

链接地址: http://www.djcxy.com/p/89633.html

上一篇: CocoaPods spec lint raises errors

下一篇: Libraries not found when using CocoaPods with iOS logic tests