Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find headers for GoogleAnalytics-iOS-SDK with Cocoapods 0.37, Swift, frameworks

Using cocoa pods 0.37.0 in a Swift project, with use_frameworks! set in the podfile, I am unable to access the header files for the GoogleAnalytics-iOS-SDK pod.

How should I access the Google Analytics pod's headers in my app?

I have tried;

import GoogleAnalytics_iOS_SDK

In a Swift file, cocoapods 0.36 style. But there's no framework created anymore so no good.

#import <GoogleAnalytics_iOS_SDK/GAI.h>

In the bridging header, but doesn't work (no module map ?)


I have read that the behaviour for pods that only include headers in their 'sourse_files' changed in cocoapods 0.37 (see this commit). This appears to be in response to the problems that use_frameworks caused with these pods in 0.36 (see this SO question).

With this change in Cocoapod behaviour, the static library is integrated correctly (it wasn't with 0.36), the symbols are compiled into the app and available at runtime. But I don't have access to the headers.

like image 837
alexkent Avatar asked May 03 '15 23:05

alexkent


1 Answers

This is a bug in Cocoapods 0.37.0. It has been logged in their tracker as issue #3499.

Workaround

  • Add $(SRCROOT)/Pods/GoogleAnalytics-iOS-SDK to the User Header Search Paths (set to Recursive) in the app target's Build Settings.
  • Reference the Google Analytics header directly in the Bridging Header with #import "GAI.h"
like image 188
alexkent Avatar answered Oct 24 '22 13:10

alexkent