ios - CocoaPods 规范 lint 引发错误

标签 ios cocoapods

我创建了一个 iOS 框架项目并向其中添加了一个 .podspec。该框架以及包含的演示项目生成得很好。 但我在 pod 规范 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/源代码在这里

最佳答案

为了看看发生了什么,我使用了

pod spec lint --no-clean ...

它将生成的测试 pod 留在/tmp 中。所以我发现在 pch 文件中添加了 QuartzCore,这对于普通项目来说是可以的,但在类文件中是不行的。

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

关于ios - CocoaPods 规范 lint 引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16100462/

相关文章:

swift - 卸载 pod 后无法进行 pod 更新

swift - Pod lib lint 错误 : Warn Swift Version

ios - 没有可见的@interface 'PhotosTableViewController'声明选择器 'viewWithImageName'

swift - Flurry.h 的桥接 header 不适用于 Pod

iphone - AVplayer 2-3 次后未在 ScrollView 中显示

ios - Objective-C:为什么在使用参数调用 objc_msgSend 时会出现 EXC_BAD_ACCESS 异常?

ios - 如何从 UIPageViewController 转到 UINavigationController 以进行 iOS 应用程序启动

git - Pod 设置的权限被拒绝(公钥)

ios - Watchkit:以编程方式设置全局色调

ios - 从 Storyboard 中实例化 View Controller 时出现 XCTestCase 错误