jessehensold
jessehensold

Reputation: 667

Trying to wrap vendor framework in cocoapod but the compiler can't find headers

Hoping somebody has already solved this; I'm trying to wrap a third-party library (Airwatch) in a cocoapod for better management across our apps. I'm having a hell of a time trying to get this to work, though. I've created a pod around a static library, but this one is a dynamic framework, and I'm having a hell of a time getting it to compile. The headers from the framework just aren't accessible in the containing app....

Here's what I have tried already:

This allows xcode to find the header for an import like:

    import "AWSDKCore.h"  //Documented as the framework's main header

But this throws an error for the existing imports within the original framework:

enter image description here

I figured this was a bad idea, but I thought I'd try naming my cocoapod the same name as the Framework (which should keep the import path). So, this throws a bunch of errors saying some enums either aren't declared or are declared twice.

If anybody has thoughts, I'd be eternally greatful...

Just for reference here's my podspec:

Pod::Spec.new do |s|
 s.name             = "AirwatchSDK"
 s.version          = "0.1.0"
 s.summary          = "A short description of AirwatchSDK."

 s.homepage         = "https://github.com/<GITHUB_USERNAME>/AirwatchSDK"
 s.license          = 'MIT'
 s.author           = { "xxxxx" => "xxxx" }
 s.source           = { :git => "https://github.com/<GITHUB_USERNAME>/AirwatchSDK.git", :tag => s.version.to_s }

 s.platform     = :ios, '8.0'
 s.requires_arc = true
 #s.module_name = 'AWSDK'
 s.source_files = 'Pod/Classes/**/*','Pod/Framework/AWSDK.framework/Versions/A/Headers/*.h'

 s.vendored_frameworks = 'Pod/Framework/AWSDK.framework'
 s.frameworks = 'CFNetwork','CoreData','CoreFoundation','CoreGraphics','CoreLocation','CoreTelephony','CoreText'
 s.libraries = 'stdc++','z','sqlite3','c++'
end

Upvotes: 11

Views: 5593

Answers (1)

jessehensold
jessehensold

Reputation: 667

Since I figured out my own answer, I thought I'd post it here for the next guy...

The key, it turns out, was to not have 'source_files' (or to comment it out). I'm not sure if that is a bug or not, but my final podspec had vendored_framework set and source_files not set like so:

#can't have source files if you want to access vendor framework
#s.source_files = 'Pod/Classes/**/*'

# airwatch framework.
s.vendored_frameworks = 'AWSDK.framework'

Upvotes: 23

Related Questions