Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CocoaPods spec lint raises errors

Tags:

ios

cocoapods

I've created an iOS framework project and added a .podspec to it. The framework is generated fine as well as the included demo project. But I'm getting errors during the pod spec lint test.

The podspec file I'm using is

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" => "[email protected]" }
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=]

Analyzed 1 podspec.

[!] The spec did not pass validation.

EDIT The directory structure is like so. /HorizontalPicker/HorizontalPicker.podspec /HorizontalPicker/HorizontalPicker/Source Code lives here

like image 319
Bernd Rabe Avatar asked Dec 16 '22 11:12

Bernd Rabe


2 Answers

To see what happened I used

pod spec lint --no-clean ...

which leaves the generated test pod inside /tmp. So I found QuartzCore was added in the pch file, which is ok for a normal project, but not in the class files.

So it was not the best coding style.

like image 194
Bernd Rabe Avatar answered Dec 17 '22 23:12

Bernd Rabe


In my case lint was testing the spec against OS X SDK instead of the iOS SDK.

Both platforms have the Security framework but the APIs are not the same, thus the errors.

Just adding s.platform = :ios to the podspec fixed it.

like image 26
Rivera Avatar answered Dec 18 '22 00:12

Rivera