Cocoapods: `pod spec lint` Fails Due to Static Library Dependency

Created on 27 Jul 2015  路  8Comments  路  Source: CocoaPods/CocoaPods

I'm trying to create a static library as a Cocoapod that depends on another Cocoapod. In my project, I have two targets, one for the library, and one for the tests. For that project, I have this podfile:

platform :ios, "7.1"

pod "RXCollections", '~> 1.0'

target :PLFetchedObjectsControllerTests, :exclusive => true do
  pod "OCMock", '3.1.1'
  pod "Foundry"
end

So my library depends on RXCollections and my library's tests depend on OCMock and Foundry.

This is the Podspec:

@version = "1.0.0"

Pod::Spec.new do |s|
  s.name         = "PLFetchedObjectsController"
  s.version      = @version
  s.summary      = "A controller for observing changes to managed objects - like an NSFetchedResultsController but with less magic."
  s.homepage     = "http://github.com/PendarLabs/PLFetchedObjectsController"

  s.description  = <<-DESC
                   ... yada yada... bla blah...
                   DESC
  s.license            = "MIT"
  s.author             = { "Hirad Motamed" => "[email protected]" }
  s.ios.deployment_target = "7.1"
  s.osx.deployment_target = "10.7"
  s.source       = { :git => "https://github.com/PendarLabs/PLFetchedObjectsController.git", :tag => @version }
  s.source_files  = "PLFetchedObjectsController", "PLFetchedObjectsController/**/*.{h,m}"
  s.requires_arc = true
  s.dependency "RXCollections"

end

This all works fine. I tested it in a new empty project by creating a podfile like this:

pod "PLFetchedObjectsController", path: "../../path/to/local/PLFetchedObjectsController"

And it installs and compiles. But somehow, pod spec lint PLFetchedObjectsController.podspec --verbose fails with this message:

PLFetchedObjectsController/PLFetchedObjectsController/PLFetchedObjectsController.m:10:9: error: 'RXCollection.h' file not found with <angled> include; use "quotes" instead

Any suggestions? I do need to keep it an angled include, do I not?

Most helpful comment

In simplified: angled bracket imports are for externals, and should be scoped according to where they come from, so this for example should be:

#import <RXCollection/RXCollection.h>

So that the compiler knows where to link correctly. I'm not sure what's changed in CP, but we shouldn't have been supporting #import <RXCollection.h> as it breaks the compiler contract.

All 8 comments

I have the same issue with a project that was working fine before. I made some very minor changes and when i tried to push the podspec, the validation failed with

    - ERROR | [iOS] Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - ERROR |  SomePath/SomeFile.h:10:9: error: 'MyDependency.h' file not found with <angled> include; use "quotes" instead

The changes in my code are not related to imports, (i just changed a condition in a class). And it was working fine last time I pushed.
The only thing I can think of that could have an impact on this is that I updated Cocoapods recently.

In simplified: angled bracket imports are for externals, and should be scoped according to where they come from, so this for example should be:

#import <RXCollection/RXCollection.h>

So that the compiler knows where to link correctly. I'm not sure what's changed in CP, but we shouldn't have been supporting #import <RXCollection.h> as it breaks the compiler contract.

I tried to do
#import
//MyDependency is a pod declared as s.dependency in the .podspec

Same error.

This isn't enough information to figure out an answer @quentinhayot - This is the pattern used in every pod with a dependency. Source - Podspec

Here is my podspec:

Pod::Spec.new do |s|
  s.name         = "QHCarouselCalendar"
  s.version      = "1.1.3"
  s.summary      = "A cool calendar based on iCarousel"
  s.homepage     = "https://github.com/quentinhayot/QHCarouselCalendar"
  s.license      = { :type => 'MIT', :file => 'LICENSE' }
  s.author       = { "Quentin Hayot" => "***@gmail.com" }
  s.source       = { :git => "https://github.com/quentinhayot/QHCarouselCalendar.git", :tag => "1.1.3" }
  s.platform     = :ios, '7.0'
  s.source_files = 'QHCarouselCalendar/QHCarouselCalendar'
  s.requires_arc = true
  s.dependency 'iCarousel', '~> 1.8.1'
  s.dependency 'UIView+Rounded', '~> 0.1.4'
end

Lint:

$ pod spec lint

 -> QHCarouselCalendar (1.1.3)
    - ERROR | [iOS] Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - ERROR | QHCarouselCalendar/QHCarouselCalendar/QHCarouselCalendar/QHCarouselCalendar.h:10:9: error: 'iCarousel.h' file not found with <angled> include; use "quotes" instead
    - ERROR | QHCarouselCalendar/QHCarouselCalendar/QHCarouselCalendar/QHCarouselCalendarDayView.m:10:9: error: 'UIView+Rounded.h' file not found with <angled> include; use "quotes" instead

Analyzed 1 podspec.
[!] The spec did not pass validation, due to 3 errors.

The dependencies are imported like this:

#import <iCarousel/iCarousel.h>
//#import <iCarousel.h> // Was like this before I read this thread (was working at my previous push)

Everything was working fine when I pushed the previous version 13 days ago. The only major change was a Cocoapods update.

I'm guessing you re-tagged version 1.1.3? It looks like you're getting a cached version of your library ( as the tag on github shows the <x/y> version. Try it again after deleting ~/Library/Caches/CocoaPods/Pods

That was it. Sorry for the thread hijack, since it wasn't related at the end :/

@orta That's how I always write my imports, but with RXCollection for some reason #import <RXCollection/RXCollection.h> gives me 'file not found', but #import <RXCollection.h> works.

I actually wrote that code a long time ago, and I just went to check the RXCollection repo only to realize it a) is unmaintained, and b) doesn't have a podspec, so I'm not sure how it ever worked or where I initially got the idea of including it with Cocoapods. I'll be removing that dependency from my project,

Was this page helpful?
0 / 5 - 0 ratings