Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods importing a framework to source code

Tags:

In my cocoapod for iOS, I have a essentially items:

  1. Open-source classes (.m & .h files)
  2. MyFramework.framework (.framework directory, header files, and .bundle for resources)

One of the open-source classes calls import <MyFramework.MyFramework.h> so it can use the components of MyFramework in its implementation. But because of this, I'm having trouble getting the podspec to pass the spec lint test (pod spec lint MyCocoapod.podspec). When I run the spec lint validation, it says:

ERROR | [iOS] [xcodebuild] .../MyFile.h:54:9: fatal error: 'MyFramework/MyFramework.h' file not found

While investigating, I noticed that the podspec does pass the spec lint validation if I remove that open-source class in the podspec's source_files section, s.source_files = 'MyFiles.{h,m}'. Any idea why my class can't import my custom framework during the spec lint validation?

The relevant code in the podspec looks like this:

s.preserve_paths      = 'myframework/MyFramework.framework' s.frameworks          = 'Foundation', 'MyFramework' s.xcconfig            = { 'FRAMEWORK_SEARCH_PATHS' => '$(SRCROOT)/myframework/' } s.public_header_files = 'MyFramework.framework/Headers/*.h', 'SourceCode/*.h' s.source_files        = 'SourceCode/*.{h,m}'  # Crashes here - Source_file imports MyFramework.h. If I take this out, it passes spec lint validation 
like image 258
johngraham Avatar asked Apr 16 '13 02:04

johngraham


1 Answers

EDIT This process is now entirely handled by the vendored_frameworks option. This handles preserving the paths, the framework search paths, and linking to the project.

like image 146
Keith Smiley Avatar answered Oct 26 '22 22:10

Keith Smiley