No such module 'FirebaseMessaging' in Xcode - ios

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.

Related

Missing GULSwizzler.h file

I've upgraded an iOS/Swift project to the latest Firebase pods.
The following changes were made:
Firebase 5.11.0 (was 5.10.0)
FirebaseAnalytics 5.3.0 (was 5.2.0)
FirebaseCore 5.1.6 (was 5.1.5)
FirebaseInstanceID 3.3.0 (was 3.2.2)
GoogleAppMeasurement 5.3.0 (was 5.2.0)
GoogleUtilities 5.3.4 (was 5.3.3)
nanopb 0.3.901 (was 0.3.8)
I'm getting an error on a missing file that's imported in GoogleUtilities at build time:
'Private/GULSwizzler.h' file not found
My pod import file has the following:
pod 'Firebase/Core'
pod 'Firebase/Storage'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/AdMob'
pod 'GoogleSymbolUtilities'
pod 'GoogleInterchangeUtilities'
Has anyone come across this or know a solution?
******************************** edit **********************************
What I see under GoogleUtilities is shown below. I note that the .h symbol is dimmed for the file that's missing.
It seems that GULSwizzler.h is not installed properly. For me, it is installed in a different location:
$ find . | grep GULSwizzler.h
./Pods/GoogleUtilities/GoogleUtilities/MethodSwizzler/Private/GULSwizzler.h
Here are a few things to try:
Reinstall from a clean environment: pod deintegrate and pod install
Make sure you have the latest version of CocoaPods:
$ pod --version
1.5.3
Probably unrelated, but strange: GoogleSymbolUtilities and GoogleInterchangeUtilities are deprecated private pods that were never intended to be added to Podfiles.

Cocoapods - FirebaseAnalytics only installed when using FirebaseCore

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.

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)

Adding Google Sheets to iOS using CocoaPods

I tried to add Google Sheets to a project, using CocoaPods, but receive an error.
Podfile:
source 'https://github.com/CocoaPods/Specs.git'
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ict' do
pod 'Google/SignIn'
pod 'GoogleAPIClientForREST/Sheets'
pod 'GTMAppAuth'
end
Error after installing Pod:
Analyzing dependencies
Downloading dependencies
Installing AppAuth (0.7.1)
Installing FirebaseAnalytics (3.9.0)
[!] Error installing FirebaseAnalytics
[!] /usr/bin/tar xfz /var/folders/_p/k47cs36s3r585kmsg84x7v580000gp/T/d20170514-96989-lvaiwn/file.tgz -C /var/folders/_p/k47cs36s3r585kmsg84x7v580000gp/T/d20170514-96989-lvaiwn
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
By following these steps and copying your Podfile contents, I did not get any error:
NOTE: The $atom Podfile part was for editing the Podfile with Atom text editor.
$ pod init
$ atom Podfile
$ pod install
Output:
Analyzing dependencies
Downloading dependencies
Installing AppAuth (0.7.1)
Installing FirebaseAnalytics (3.9.0)
Installing FirebaseCore (3.6.0)
Installing FirebaseInstanceID (1.0.10)
Installing GTMAppAuth (0.5.0)
Installing GTMOAuth2 (1.1.4)
Installing GTMSessionFetcher (1.1.9)
Installing Google (3.0.3)
Installing GoogleAPIClientForREST (1.2.1)
Installing GoogleSignIn (4.0.2)
Installing GoogleToolboxForMac (2.1.1)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `ict.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 11 total pods installed.
MacBook-Pro:ict Bajo$

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

Resources