Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • When I set vendored_libraries in podspec i can't seem to access headers with either quotes or <>. Xcode just complains as 'Not Found'
  • Next, I tried adding the path of the headers in the framework as source_files like so

    s.source_files = 'Pod/Classes/**/*','Pod/Framework/AWSDK.framework/Versions/A/Headers/*.h'
    

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
like image 262
jessehensold Avatar asked Oct 23 '15 20:10

jessehensold


People also ask

What is Use_frameworks in Podfile?

use_frameworks! in the Podfile means that we want the listed frameworks to be dynamically installed instead as static frameworks.


1 Answers

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'
like image 149
jessehensold Avatar answered Oct 23 '22 11:10

jessehensold