Cocoapods: Cocoapods does not create framework target for Google analytics

Created on 3 Apr 2017  路  7Comments  路  Source: CocoaPods/CocoaPods

My cocoapods file specifies Google Analytics framework target for my project

use_frameworks!
pod "Google/Analytics"

However after the pod is installed, I cannot see the GoogleAnalytics framework target generated, and I still need to import the Google Analytics header in my bridging header file. What did I miss here?

The full pod file is

use_frameworks!

target 'AnalyticsKit' do
  use_frameworks!
  workspace 'MY'
  project 'AnalyticsKit/AnalyticsKit.xcodeproj'
  platform :ios, '8.0'
  pod "Google/Analytics"
end

All 7 comments

@vminc This is expected behavior. The pods being installed (with the exception of GoogleToolboxForMac) are pre-built pods (look into your Pods/ folder to see the .framework files). There is no need to create a target if there are no sources to build.

Closing as this is working as intended.

Also see the generated xcconfig flags:

OTHER_LDFLAGS = $(inherited) -ObjC -l"GoogleAnalytics" -l"c++" -l"sqlite3" -l"stdc++" -l"z" 
-framework "AddressBook" -framework "AssetsLibrary" -framework "CoreData" -framework 
CoreFoundation" -framework "CoreLocation" -framework "CoreMotion" -framework 
"FirebaseAnalytics" -framework "FirebaseCore" -framework "FirebaseInstanceID" -framework 
"GGLAnalytics" -framework "GGLCore" -framework "GoogleToolboxForMac" -framework 
"MessageUI" -framework "StoreKit" -framework "SystemConfiguration"

Thanks, how do I import "GAI.h" from this framework without using a bridging header? I import GGLAnalytics but "GAI.h" is not there. The problem is I want to use this module in a framework in which a bridging header is not supported...

I ran into the same problem with the "GoogleAnalytics" pod as well (it's a different pod from "Google/Analytics")

use_frameworks!
pod "GoogleAnalytics"

Is this in Swift or ObjC? In ObjC I did #import <GoogleAnalytics/GAI.h> and worked.

For Swift this worked for me:

import Google.Analytics

func hello() -> String {
    var g = GAI();
    g.optOut = false
    return "";
}

This is swift code. I can "import Google.Analytics" without errors, however I still got "Unresolved identifier" when referencing GAI.

@vminc Do you have it resolved?

Was this page helpful?
0 / 5 - 0 ratings