wibosco
wibosco

Reputation: 967

"error: expected a type" error when running "pod spec lint"

I'm attempting to convert an existing project into a cocoapod so that it will be easier to use however when I run

pod spec lint --verbose

I get a number of errors similar to

- ERROR | [iOS] xcodebuild: CoreDataServices/CoreDataServices/Services/Count/CDSCountService.m:28:9: error: use of undeclared identifier 'NSFetchRequest'

I have the following as my podspec:

 Pod::Spec.new do |s|

  s.name         = "CoreDataServices"
  s.version      = "0.2.0"
  s.summary      = "CoreDataServices contains a set of helper classes to abstract away common core data functionality."

  s.homepage     = "http://www.williamboles.me"
  s.license      = { :type => 'MIT', 
                     :file => 'LICENSE.md' }
  s.author       = "William Boles"

  s.platform     = :ios, "8.0"

  s.source       = { :git => "https://github.com/wibosco/CoreDataServices.git", 
                     :branch => "master", 
                     :tag => s.version }

  s.source_files  = "CoreDataServices/**/*.{h,m}"
  s.public_header_files = "CoreDataServices/**/*.{h}"

  s.frameworks = 'UIKit', 'CoreData'

  s.requires_arc = true

end

I have cocoapod version 0.39.0 installed.

Building the project using xcodebuild outside of cocoapods results in the project being built without errors.

Upvotes: 1

Views: 372

Answers (1)

wibosco
wibosco

Reputation: 967

I managed to get there in the end but it's an odd one:

Pod::Spec.new do |s|

  s.name         = "CoreDataServices"
  s.version      = "0.2.0"
  s.summary      = "CoreDataServices contains a set of helper classes to abstract away common core data functionality."

  s.homepage     = "http://www.williamboles.me"
  s.license      = { :type => 'MIT', 
                     :file => 'LICENSE.md' }
  s.author       = "William Boles"

  s.platform     = :ios, "8.0"

  s.source       = { :git => "https://github.com/wibosco/CoreDataServices.git", 
                     :branch => "master", 
                     :tag => s.version }

  s.source_files  = "CoreDataServices/**/*.{h,m}"
  s.public_header_files = "CoreDataServices/**/*.{h}"

  s.requires_arc = true

  s.frameworks = 'UIKit', 'CoreData'

end

I moved s.requires_arc = true to be above s.framework = 'UIKit', 'CoreData' and the errors went away.

I also noticed that if I inverted the ordering of the framesworks so that it becomes

s.frameworks = 'CoreData', 'UIKit'

s.requires_arc = true 

that also worked

Upvotes: 1

Related Questions