Cocoapods - FirebaseAnalytics only installed when using FirebaseCore - ios

So, this question is not about how to fix something, but about how it is working this way.
I want to use FirebaseMessage in my app for push notifications, which have a dependency FirebaseCore. I started just adding FirebaseMessage to my Podfile
pod 'Firebase/Messaging'
I got installed:
Installing Firebase (5.4.1)
Installing FirebaseCore (5.0.6)
Installing FirebaseInstanceID (3.1.1)
Installing FirebaseMessaging (3.0.3)
Installing GoogleToolboxForMac (2.1.4)
Installing Protobuf (3.6.0)
Okey, problem here is that I get a warning when building the project, because FirebaseAnalytics is missing. No problem, I can add:
pod 'Firebase/Messaging'
pod 'Firebase/Core'
and get:
Installing Firebase (5.4.1)
Installing FirebaseAnalytics (5.0.1)
Installing FirebaseCore (5.0.6)
Installing FirebaseInstanceID (3.1.1)
Installing FirebaseMessaging (3.0.3)
Installing GoogleToolboxForMac (2.1.4)
Installing Protobuf (3.6.0)
Installing nanopb (0.3.8)
...and I get nanopb and FirebaseAnalytics extra.
Why is this happening? Looking at the podspecs, FirebaseCore has no dependencies related to FirebaseAnalytics:
https://github.com/CocoaPods/Specs/blob/master/Specs/8/b/d/FirebaseCore/5.0.6/FirebaseCore.podspec.json
I would like to find what tells cocoapods to install the FirebaseAnalytics pod, and why it only happens when I specifically install FirebaseCore.

Firebase/Core is the Core subspec of the Firebase pod. See details in the Firebase podspec.
While the FirebaseCore pod does not depend on FirebaseAnalytics, the Core subspec of the Firebase pod does.
It is unfortunate that "Core" is overloaded in Firebase terminology, but would tricky to change at this point without breaking a lot of apps.

Related

No such module 'FirebaseMessaging' in Xcode

I'm trying to add Push Notifications to my iOS app in Xcode but getting the No such module 'FirebaseMessaging' error when I try to import FirebaseMessaging (FYI: import Firebase working just fine).
Running pod installs in Terminal shows that the FirebaseMessaging package was installed:
Downloading dependencies
Installing Firebase (10.5.0)
Installing FirebaseAnalytics (10.5.0)
Installing FirebaseCore (10.5.0)
Installing FirebaseCoreInternal (10.5.0)
Installing FirebaseInstallations (10.5.0)
Installing FirebaseMessaging (10.5.0)
Installing GoogleAppMeasurement (10.5.0)
Installing GoogleDataTransport (9.2.1)
Installing GoogleUtilities (7.11.0)
Installing PromisesObjC (2.1.1)
Installing nanopb (2.30909.0)
Generating Pods project
Integrating client project
And, here's my pod file:
platform :ios, '11.0'
target 'AppName' do
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'FirebaseMessaging'
end
Any suggestions for how to fix this error?
I tried installing Firebase Messaging but it's not working in Xcode.

'GoogleUtilities/GULAppEnvironmentUtil.h' file not found

Trying to compile my project after adding some pods. While compiling it gives below error
'GoogleUtilities/GULAppEnvironmentUtil.h' file not found
Podfile.lock snippet
- FirebaseCore (5.1.1):
- GoogleUtilities/Logger (~> 5.2)
- FirebaseDynamicLinks (3.0.2):
- FirebaseAnalytics (~> 5.1)
- FirebaseInAppMessaging (0.11.0):
- FirebaseAnalytics (~> 5.1)
- FirebaseCore (~> 5.1)
- FirebaseInstanceID (~> 3.2)
- GoogleUtilities/Environment (~> 5.0)
- FirebaseInstanceID (3.2.1):
- FirebaseCore (~> 5.1)
- GoogleUtilities/Environment (~> 5.2)
- FirebaseMessaging (3.1.0):
- FirebaseCore (~> 5.0)
- FirebaseInstanceID (~> 3.0)
- GoogleUtilities/Reachability (~> 5.2)
- Protobuf (~> 3.1)
- FirebaseRemoteConfig (3.0.1):
- FirebaseABTesting (~> 2.0)
- FirebaseAnalytics (~> 5.1)
- FirebaseCore (~> 5.1)
- FirebaseInstanceID (~> 3.2)
- GoogleUtilities/Environment (~> 5.2)
- "GoogleUtilities/NSData+zlib (~> 5.2)"
- Protobuf (~> 3.5)
- Google/Analytics (2.0.4):
- Google/Core
- GoogleAnalytics (~> 3.12)
- Google/Core (2.0.4):
- GoogleInterchangeUtilities (~> 1.0)
- GoogleNetworkingUtilities (~> 1.0)
- GoogleSymbolUtilities (~> 1.0)
- GoogleUtilities (~> 1.1)
In the Podfile, change Google/Analytics to GoogleAnalytics. The Google pod is deprecated and not compatible with recent Firebase versions.
An alternative, but not recommended workaround, could be to lock the Firebase version to something less than 5.5.
UPDATE: June 2021: There is a Crashlytics podspec bug that can also cause this issue. The workaround is to explicitly add GoogleUtilities/Environment to the Podfile or move use_frameworks! to the top of the Podfile. Details in https://github.com/firebase/firebase-ios-sdk/issues/8137. The issue will be fixed in the upcoming Firebase 8.3.0 release.
Problem fixed for me by following steps:
Clean the project
Close the Xcode
Delete derived data
If you have already installed the POD, kindly delete the “.xcworkspace” & “Podfile.lock” files
Install pod again
Open “.xcworkspace” and Run
Running pod update fixed this for me
Deleting Pods folder and reinstalling the pods again will fix the issue.
Try This:
Delete the pod files related to Google and Firebase
Install pods via "pod install" command
If pod file contains below pods, update those pods
Google/Analytics to GoogleAnalytics
Google/SignIn to GoogleSignIn
Google/Analytics and Google/SignIn are deprecated.
try to add this plugin :
cordova plugin add cordova-plugin-cocoapod-support --save
After go to platform/ios and run :
pod update
In the podfile, install all pods after uncomment use_frameworks!.
If you already installed pods then remove pods, and install again after uncomment use_frameworks
As simple as that
comment the pod
pod install
uncomment the pod (Make sure there is not version added to pod)
pod install
There you go.
None of the answers listed here worked for me.
The solution that worked for me is:
Clean the project and close the Xcode
Clean the pod using command pod clean
Install the pod again using pod install
Open the project and build that one, it worked

How to solve Use of unresolved identifier 'SetOptions'?

I have updated Firestore to follows. Now, I can't use it anymore. I removed, reinstalled several times. But there is no change. I am losing my mind. The issue is:
"Use of unresolved identifier 'SetOptions'".
db.collection("").document("").setData([ "p1answered":false, "p1OutofTime": false ], options: SetOptions.merge())
Bolts (1.9.0)
Using BoringSSL (10.0.2)
Using FBSDKCoreKit (4.33.0)
Using FBSDKLoginKit (4.33.0)
Using Firebase (5.0.1)
Using FirebaseAnalytics (5.0.0)
Using FirebaseAuth (5.0.0)
Using FirebaseCore (5.0.1)
Using FirebaseFirestore (0.12.1)
Using FirebaseInstanceID (3.0.0)
Using FirebaseUI (5.0.0)
Using GTMOAuth2 (1.1.6)
Using GTMSessionFetcher (1.1.15)
Using Google-Mobile-Ads-SDK (7.31.0)
Using GoogleSignIn (4.1.2)
Using GoogleToolboxForMac (2.1.4)
Using Protobuf (3.5.0)
Using SwiftySound (1.0.0)
Using TwitterCore (3.1.0)
Using TwitterKit (3.3.0)
Using gRPC (1.12.0)
Using gRPC-Core (1.12.0)
Using gRPC-ProtoRPC (1.12.0)
Using gRPC-RxLibrary (1.12.0)
Using leveldb-library (1.20)
Using nanopb (0.3.8)
//Pod File
Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Tahmin Et' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for My App
pod 'SwiftySound'
pod 'FirebaseUI/Google'
pod 'FirebaseUI/Facebook'
pod 'Google-Mobile-Ads-SDK'
pod 'FirebaseUI/Twitter'
pod 'FirebaseCore'
pod 'FirebaseAuth'
pod 'FirebaseFirestore'
end
Your code is okay, you just need to import FirebaseFirestore in your class.
Edit: After discussion
pod 'FirebaseFirestore' is also not correct. It should be pod 'Firebase/Firestore'. Have a look at Firebase getting started guide choose iOS tab under Set up your development environment.
Edit: 2
In latest documentation it is like:
db.collection("cities").document("BJ").setData([ "capital": true ], merge: true)

Upgrade to Swift 3 Error- ld: framework not found GoogleInterchangeUtilities

I just upgraded to Swift 3 from 2.2. I'm using Firebase, Google Maps, Google Places, SwiftyJSON, Alamofire 4.4, and SDWebImage. I reinstalled all the pods, ran git commit, and fixed all the errors except this one:
ld: framework not found GoogleInterchangeUtilities clang:
error: linker command failed with exit code 1 (use -v to see
invocation)
(null): Framework not found
GoogleInterchangeUtilities
(null): Linker command failed with exit code 1 (use -v to see
invocation)
Where do I find GoogleInterchangeUtilities and how do I install or fix it?
When I upgraded from Swift 2.2 to Swift 3 the first thing I did was clean and remove my cocoapods:
pod deintegrate
pod clean
pod cache clean --all
rm Podfile
For some reason when I reinstalled all of the pods I originally had, the GoogleInterchangeUtilities file plus several others were removed in the process:
Analyzing dependencies
Removing GoogleInterchangeUtilities //**REMOVED**
Removing GoogleNetworkingUtilities //**REMOVED**
Removing GoogleParsingUtilities //**REMOVED**
Removing GoogleSymbolUtilities //**REMOVED**
Removing GoogleUtilities //**REMOVED**
Downloading dependencies
Installing Alamofire 3.5.1 (was 3.4.1)
Installing Firebase 3.15.0 (was 3.3.0)
Installing FirebaseAnalytics 3.7.0 (was 3.2.1)
Installing FirebaseAuth 3.1.1 (was 3.0.3)
Installing FirebaseCore (3.5.2)
Installing FirebaseCrash 1.1.6 (was 1.0.6)
Installing FirebaseDatabase 3.1.2 (was 3.0.2)
Installing FirebaseDynamicLinks 1.3.4 (was 1.1.0)
Installing FirebaseInstanceID 1.0.9 (was 1.0.7)
Installing FirebaseStorage 1.1.0 (was 1.0.2)
Installing GTMSessionFetcher (1.1.9)
Installing GoogleMaps 2.2.0 (was 1.13.2)
Using GooglePlacesAPI (1.0.6)
Installing GoogleToolboxForMac (2.1.1)
Installing ObjectMapper 1.5.0 (was 1.3.0)
Installing Protobuf (3.2.0)
Using SDWebImage (3.8.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 10 dependencies from the Podfile and 17 total pods installed.
I eventually went to Google and typed in GoogleInterchangeUtilities which led me to it's pod install page here. I reinstalled the pod which removed the error but then each of the other files that were removed resulted in their own ld: framework not found... Xcode errors.
Long story short if you cleaned and removed your cocoapods file and reinstalled everything, there's a possibility the Google...Utilities frameworks will get removed. You have to include those specific individual pods back in your pod file and run: pod install again.
Here is my pod file with them included in addition to all my other pods:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'myProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for myProject
pod 'GoogleInterchangeUtilities', '~> 1.2'
pod 'GoogleNetworkingUtilities', '~> 1.2'
pod 'GoogleParsingUtilities', '~> 1.1'
pod 'GoogleSymbolUtilities', '~> 1.1'
pod 'GoogleUtilities', '~> 1.3'
//all my other pods...
Here are their cocoapods install pages:
GoogleInterchangeUtilities
GoogleNetworkingUtilities
GoogleParsingUtilities
GoogleSymbolUtilities
GoogleUtilities

Google Analytics Pod installs too many dependencies

I've just included the Google Analytics Pod as described in their iOS developer guide with:
pod 'Google/Analytics'
When running
pod install
it installs the following dependencies:
Installing FirebaseAnalytics (3.2.0)
Installing FirebaseInstanceID (1.0.6)
Installing Google (3.0.3)
Installing GoogleAnalytics (3.14.0)
Installing GoogleInterchangeUtilities (1.2.1)
Installing GoogleSymbolUtilities (1.1.1)
Installing GoogleUtilities (1.3.1)
Since I don't use Firebase, I would like to get rid of the FirebaseAnalytics and FirebaseInstanceID (as well as all pods that are not needed by the framework itself).
Installing unused dependencies only bloats up my app size. I would like to only install the absolute minimum amount of pods to get GoogleAnalytics running.
Any ideas on how to kick the unused Pods out?
As seen in this answer, you can use:
pod 'GoogleAnalytics'
…to avoid installing the dependencies. Note that you'll need to change your Objective-C imports in your bridging header file; I needed at least:
#import <GoogleAnalytics/GAI.h>
#import <GoogleAnalytics/GAIFields.h>
#import <GoogleAnalytics/GAIDictionaryBuilder.h>

Resources