Why am I getting undefined symbol _OBJC_CLASS_$_FIRInstanceID? - ios

This is an iOS app that uses Firebase.
If I comment out code that gets Firebase's instanceID tokens, then I'm able to compile and link.
I installed Firebase with CocoaPods. No errors at all, no warnings. (Before pod install I did pod update. So I got the latest Firebase.)
The reference comes from AppDelegate.o. In AppDelegate.swift I have
import UserNotifications
import Firebase
import FirebaseInstanceID
import FirebaseMessaging
import GoogleUtilities
I know you'll ask to see a lot more about the environment. I'm not sure everything I should show you. I'll edit the question as you request more information.
UPDATE 1: Here's something I also notice in the output window.
<Warning>: 5.8.0 - [Firebase/Core][I-COR000022] Firebase Analytics is not available. To add it, include Firebase/Core in the Podfile or add FirebaseAnalytics.framework to the Link Build Phase
But my Podfile looks just fine. Here's my Podfile.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'XKCD' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for XKCD
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'XKCDTests' do
inherit! :search_paths
# Pods for testing
end
target 'XKCDUITests' do
inherit! :search_paths
# Pods for testing
end
end
UPDATE 2: Here's what seems as a pretty relevant event. I added Firebase/Database to my Podfile just to see if I could use the database. I couldn't even compile the project with more linking errors, so I totally gave up on the task, removed Firebase/Database from my Podfile and said pod install to my shell once again to reflect my change of mind. Here's what happened:
$ pod install
Analyzing dependencies
Removing FirebaseAuth
Removing FirebaseAuthInterop
Removing FirebaseDatabase
Removing GTMSessionFetcher
Removing leveldb-library
Downloading dependencies
Installing Firebase 5.11.0 (was 5.8.0)
Installing FirebaseAnalytics 5.3.0 (was 5.1.2 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing FirebaseAnalyticsInterop (1.1.0)
Installing FirebaseCore 5.1.6 (was 5.1.3 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing FirebaseInstanceID 3.3.0 (was 3.2.1 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing FirebaseMessaging 3.2.1 (was 3.1.2 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing GoogleAppMeasurement 5.3.0 (was 5.1.2 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing GoogleUtilities 5.3.4 (was 5.2.3)
Using Protobuf (3.6.1)
Using nanopb (0.3.8)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 10 total pods installed.
[!] Automatically assigning platform `ios` with version `8.0` on target `XKCD` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
I make no conclusions for the moment. (Uncommenting the InstanceID code and trying to compile it again blows the same message about undefined symbol _OBJC_CLASS_$_FIRInstanceID. Commenting it out and recompiling runs the app just fine, though I still see that "Firebase Analytics is not available" message in the output window.)

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 not updating Firebase SDK to Version 4.0.0

I am trying to update my Swift project to Firebase's new SDK Version 4.0.0 using CocoaPods (as suggested by the documentation) but the updated SDK does not seem to be installing even when I follow the steps in the documentation.
Can anyone help my understand why this is not working and what I can do to update to the new Firebase SDK?
My Podfile
# Uncomment this line to define a global platform for your project
platform :ios, '9.2'
# Uncomment this line if you're using Swift
use_frameworks!
target 'myProject' do
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Core'
pod 'Firebase/Storage'
pod 'Firebase/Database'
pod 'Firebase/Crash'
pod 'Firebase/Messaging'
pod 'Alamofire', '~> 4.4'
end
When I run pod install I get this seemingly promising output (except that it is not version 4 as I think it should be):
Analyzing dependencies
Downloading dependencies
Using Alamofire (4.4.0)
Installing Firebase 3.17.0 (was 3.17.0)
Using FirebaseAnalytics (3.9.0)
Using FirebaseAuth (3.1.1)
Using FirebaseCore (3.6.0)
Using FirebaseCrash (1.1.6)
Using FirebaseDatabase (3.1.2)
Using FirebaseInstanceID (1.0.10)
Using FirebaseMessaging (1.2.3)
Using FirebaseStorage (1.1.0)
Using GTMSessionFetcher (1.1.9)
Using GoogleToolboxForMac (2.1.1)
Using Protobuf (3.3.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 8 dependencies from the Podfile and 13 total pods installed.
I can tell it isn't updating to the most recent SDK as well because the new firebase documentation does not match the functions that work in my project. My project is in Swift, so for example:
Works
FIRApp.configure()
Does not work (but is suggested by documentation)
FirebaseApp.configure()
I did try these solutions as well:
https://stackoverflow.com/a/38135857/4206520
https://stackoverflow.com/a/37365721/4206520
There was nothing wrong with your original Podfile ;) You are just confusing pod install with pod update — you were running the former but you should be using the latter instead. A brief overview to clear things up:
pod install. When you run pod install, it only resolves dependencies for pods that are not already listed in the Podfile.lock. For pods in Podfile.lock, it downloads the explicit version listed there, without checking if a newer version is available — I believe this (expected) behavior was causing your issue.
pod update. If you run pod update, CocoaPods will update every pod listed in your Podfile to the latest version possible. Of course, respecting the version restrictions declared in your Podfile, if any.
For more information, be sure to check the pod install vs. pod update guide as well.
I had a similar issue and was stuck at the following output even after running the run pod repo remove master and pod install and pod update:
Using AmazonAd (2.2.15)
Using Firebase (3.17.0)
Using FirebaseAnalytics (3.9.0)
Using FirebaseCore (3.6.0)
Using FirebaseInstanceID (1.0.10)
Using Google (3.1.0)
Using Google-Mobile-Ads-SDK (7.19.1)
Using GoogleToolboxForMac (2.1.1)
I kept seeing the note in the pod update command output:
[!] Google has been deprecated
So I deleted the Google from the podfile:
pod Google
Then I re-ran:
pod update
and Received:
Using AmazonAd (2.2.15)
Installing Firebase 4.3.0 (was 3.17.0)
Installing FirebaseAnalytics 4.0.4 (was 3.9.0)
Installing FirebaseCore 4.0.8 (was 3.6.0)
Installing FirebaseInstanceID 2.0.4 (was 1.0.10)
Installing Google-Mobile-Ads-SDK 7.24.1 (was 7.19.1)
Using GoogleToolboxForMac (2.1.1)
Installing nanopb (0.3.8)
I had the same problem and just fixed it by changing the pod subsec into the full name of the pods like this:
- pod 'Firebase/Core'
- pod 'Firebase/RemoteConfig'
+ pod 'FirebaseCore', '4.0.9'
+ pod 'FirebaseRemoteConfig', '2.0.3'
Rather weird that this confusion happened in the first place but at least this fixes it.
Similarly to how Alamofire in my original podfile states the version I would like, doing so for firebase made it update to version 4.0.0 and the appropriate firebase functions work now.
For example:
Change (for each):
pod 'Firebase/Auth'
To:
pod 'Firebase/Auth', '~> 4.0.0'
A full example of my new podfile and the output after running pod install is as follows.
Correct Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.2'
# Uncomment this line if you're using Swift
use_frameworks!
target 'myProject' do
pod 'Firebase', '~> 4.0.0'
pod 'Firebase/Auth', '~> 4.0.0'
pod 'Firebase/Core', '~> 4.0.0'
pod 'Firebase/Storage', '~> 4.0.0'
pod 'Firebase/Database', '~> 4.0.0'
pod 'Firebase/Crash', '~> 4.0.0'
pod 'Firebase/Messaging', '~> 4.0.0'
pod 'Alamofire', '~> 4.4'
end
Output
Analyzing dependencies
Downloading dependencies
Using Alamofire (4.4.0)
Using Firebase (4.0.0)
Using FirebaseAnalytics (4.0.0)
Using FirebaseAuth (4.0.0)
Using FirebaseCore (4.0.0)
Using FirebaseCrash (2.0.0)
Using FirebaseDatabase (4.0.0)
Using FirebaseInstanceID (2.0.0)
Using FirebaseMessaging (2.0.0)
Using FirebaseStorage (2.0.0)
Using GTMSessionFetcher (1.1.10)
Using GoogleToolboxForMac (2.1.1)
Using Protobuf (3.3.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 8 dependencies from the Podfile and 13 total pods installed
Podfile
platform :ios, '10.0'
# ignore all warnings from all pods
inhibit_all_warnings!
use_frameworks!
def pods
pod 'Firebase/Core'
end
Terminal
pod --version
1.3.1
pod update
CocoaPods 1.5.3 is available.
To update use: `sudo gem install cocoapods`
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.5.3
sudo gem install cocoapods
Password:
Fetching: cocoapods-core-1.5.3.gem (100%)
Successfully installed cocoapods-core-1.5.3
Fetching: cocoapods-deintegrate-1.0.2.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.2
Fetching: cocoapods-downloader-1.2.1.gem (100%)
Successfully installed cocoapods-downloader-1.2.1
Fetching: molinillo-0.6.6.gem (100%)
Successfully installed molinillo-0.6.6
Fetching: cocoapods-1.5.3.gem (100%)
Successfully installed cocoapods-1.5.3
Parsing documentation for cocoapods-core-1.5.3
Installing ri documentation for cocoapods-core-1.5.3
Parsing documentation for cocoapods-deintegrate-1.0.2
Installing ri documentation for cocoapods-deintegrate-1.0.2
Parsing documentation for cocoapods-downloader-1.2.1
Installing ri documentation for cocoapods-downloader-1.2.1
Parsing documentation for molinillo-0.6.6
Installing ri documentation for molinillo-0.6.6
Parsing documentation for cocoapods-1.5.3
Installing ri documentation for cocoapods-1.5.3
Done installing documentation for cocoapods-core, cocoapods-deintegrate, cocoapods-downloader, molinillo, cocoapods after 8 seconds
5 gems installed
pod install
Installing Firebase (5.5.0)
Installing FirebaseAnalytics (5.1.0)
Installing FirebaseCore (5.1.0)
Installing FirebaseInstanceID (3.2.0)
Installing GoogleAppMeasurement (5.1.0)
Installing GoogleUtilities (5.2.2)
Installing nanopb (0.3.8)
I have the same problem with Ionic and Capacitor too, from this instruction:
https://firebase.google.com/docs/dynamic-links/custom-domains
look like you are missing the FirebaseDynamicLinkCustomDomains, you should update this to your ios project:
for example, if your url is:
encodedLink = https://yourtargetlink.com (you should encode it to this https%3A%2F%2Fyourtargetlink.com)
dynamiclink = https://yourfirebasedynamiclink.com/link/?link=${encodedLink}&apn=com.example&isi=1449448875&ibi=com.example
You should add this key to your ios project
// Info.plist
<dict>
<key>FirebaseDynamicLinksCustomDomains</key>
<array>
<string>https://yourtargetlink.com</string>
<string>https://yourfirebasedynamiclink.com/link</string>
</array>
</dict>

Firebase pod install - pod 'Firebase/Database' - Required a higher minimum deployment target

I am trying to install Firebase/Database like Firebase doc https://firebase.google.com/docs/ios/setup#available_pods but when I tried I got issue.
[!] Unable to satisfy the following requirements:
Firebase/Database required by Podfile
Specs satisfying the Firebase/Database dependency were found, but they required a higher minimum deployment target.
Required a higher minimum deployment target, how can I do this?
Thanks
Screenshot
This is how I fixed it.
Step 1
Install Regular Firebase - pod 'Firebase', '>= 2.5.1'
Step 2
Update - pod update
*At this point it will take a good couple minutes to update. You should see something like this.
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing Firebase 3.2.0 (was 3.2.0)
Using FirebaseAnalytics (3.2.0)
Installing FirebaseAuth (3.0.2)
Using FirebaseDatabase (3.0.1)
Using FirebaseInstanceID (1.0.6)
Using GoogleInterchangeUtilities (1.2.1)
Installing GoogleNetworkingUtilities (1.2.1)
Using GoogleSymbolUtilities (1.1.1)
Using GoogleUtilities (1.3.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 4 dependencies from the Podfile and 10
total pods installed.
Step 3
Now you should have Firebase 3. So you can add frameworks like such in your pod file then pod update
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'xMarket' do
end
target 'xMarketTests' do
end
target 'xMarketUITests' do
end
pod 'Firebase', '>= 2.5.1'
pod ‘Firebase/Core’
pod ‘Firebase/Database’
pod ‘Firebase/Auth’
Good luck!
In your Podfile, change the line pod 'Firebase' to pod Firebase/Core and run pod update in the project folder.
With the new Firebase, there is no need for the first line.
From the migration guide:
Reference: Firebase.google migration guide
I got it working by first running pod repo update and then running pod install again.
Follow this steps:
pod repo remove master
pod setup
pod install
I had the same problem.My error below
[!] Unable to satisfy the following requirements:
- `Firebase/AdMob` required by `Podfile`
Specs satisfying the `Firebase/AdMob` dependency were found, but they required a higher minimum deployment target.
Targets->general->deployment target
Changed to 8.0
My project deployment target starts from ios 6 Since it developed in older xcode version.For new updation in xcode 8 I made the deployment target from ios 8It works from me.
After fix its working
Installing Firebase (4.0.2)
Installing FirebaseAnalytics (4.0.1)
Installing FirebaseCore (4.0.2)
Installing FirebaseInstanceID (2.0.0)
Installing Google-Mobile-Ads-SDK (7.20.0)
Installing GoogleToolboxForMac (2.1.1)
The latest Firebase will support from ios 8.
or you can update the Podfile
platform :ios, '9.0'
run 'pod update'
that wo
In my case, I had a similar error, running from jenkins. When I deleted the offending workspace and reran, all was well.
you can try to delete Podfile.lock

Pod install not updating pods in XCWorkspace

My podfile has:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'CoChat' do
pod 'Firebase', '>= 2.5.0'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
pod 'AFNetworking', '~> 3.0'
#pod 'MobileDeepLinking-iOS'
end
I run pod install and get:
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Using AFNetworking (3.0.4)
Using Bolts (1.6.0)
Using FBSDKCoreKit (4.10.0)
Using FBSDKLoginKit (4.10.0)
Using FBSDKShareKit (4.10.0)
Using Firebase (2.5.1)
Installing FirebaseUI (0.3.2)
Installing Google (1.3.2)
Installing GoogleAppUtilities (1.0.0)
Installing GoogleAuthUtilities (1.0.1)
Installing GoogleInterchangeUtilities (1.1.0)
Installing GoogleNetworkingUtilities (1.0.0)
Installing GoogleSignIn (2.4.0)
Installing GoogleSymbolUtilities (1.0.3)
Installing GoogleUtilities (1.1.0)
[!] The 'Pods-CoChat' target has transitive dependencies that include static binaries: (/Users/Nathan/Library/Mobile Documents/com~apple~CloudDocs/Desktop/CoChat/Pods/Google/Libraries/libGGLCore.a and /Users/Nathan/Library/Mobile Documents/com~apple~CloudDocs/Desktop/CoChat/Pods/Google/Libraries/libGGLSignIn.a)
When you open the XCWorkspace, nothing has changed. The FirebaseUI pod/framework is not there. Not a clue why this isn't installing.
I'm facing the same problem. The problem is with FirebaseUI/Auth and Google Sign in.
Solution
comment out use_frameworks!
Use bridging headers files by creating
a cocoa touch file, remember to check the box for 'Create a bridging
header file' and then after creation only deleting the .m .h files
as you want the bridging header file. Manually call out the headers
files from there.
If you read the posts on https://github.com/firebase/FirebaseUI-iOS/issues?q=is%3Aissue+is%3Aclosed, some seem to have similar issue. One possible fix is to get the 0.2.6 version of FirebaseUI by including '~>0.2.6' beside the firebaseUI pod
Hope this helps and hopefully this bug is fixed.

"pod update" doesn't update to latest version

Here is my podfile I use in the project:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
pod 'AFNetworking', '~> 2.0'
pod 'GoogleMaps'
pod 'MONActivityIndicatorView'
pod 'NYXImagesKit'
pod 'MagicalRecord'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
pod 'Countly'
The problem is that cocoapods 0.39 is updating AFNetworking to version 2.5.4 which is wrong. The latest version is 2.6.3 Also facebook SDK updating to 4.4 (latest is 4.8) etc.
I tried to delete Pods folder and .lock file but doesn't help
Also tried to clean the cocoapods cache but didn't help:
MACMINI:myproject myusername$ pod cache clean --all
MACMINI:myproject myusername$ pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (2.5.4)
Installing Bolts (1.2.0)
Installing Countly (15.06.01)
Installing FBSDKCoreKit (4.4.0)
Installing FBSDKLoginKit (4.4.0)
Installing FBSDKShareKit (4.4.0)
Installing GoogleMaps (1.10.1)
Installing MONActivityIndicatorView (0.0.3)
Installing MagicalRecord (2.3.0)
Installing NYXImagesKit (2.3)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `myproject.xcworkspace` for this project from now on.
Sending stats
Sending stats
Pod installation complete! There are 9 dependencies from the Podfile and 10 total pods installed.
In my case, Neon wouldn't update for me. It turns out it was because of the deployment target.
Changed
platform :ios, '8.0'
to
platform :ios, '10.0'
And update worked normally.
One of the reasons CocoaPods won't pick up the latest version of the pod could be another dependency that required an earlier version.
For example, suppose the latest version of PodA is 2.6 and you have this in your Podfile:
pod 'PodA', '~> 2.0'
pod 'PodB'
Unbeknown to you, PodB has the following dependency:
"PodA": "~> 2.5.4"
When CocoaPods tries to satisfy the dependencies, it will reject version 2.6 of PodA because it fails to satisfy the stronger dependency constraint on PodB.
One way to troubleshoot this is to ask CocoaPods to print the internal dependency graph debugging information by setting the following environment variable prior to running "pod update"
export MOLINILLO_DEBUG=1
Installing latest cocoapods worked for me.
sudo gem install cocoapods
I tried a new pod and it get me the latest
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (2.6.3)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `AfnetworkingPodFic.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Try clearing the cache of Cocoapods
you can find how to from below
https://gist.github.com/mbinna/4202236
Hope it helps :)
$ pod update
in terminal type this command, call update all pod to new version
Clean the pods cache in below paths and do pod install again.
~/Library/Caches/CocoaPods/
~/.cocoapods/repos/ibm-cocoapods-specs
Removing and reinstalling of cocoapods solved the problem:
MACMINI:myproject myusername$ sudo rm -fr ~/.cocoapods/repos/master
Password:
MACMINI:myproject myusername$ pod setup
Setting up CocoaPods master repo
Setup completed
MACMINI:myproject myusername$ cd ~/myproject/
MACMINI:myproject myusername$ pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing AFNetworking 2.6.3 (was 2.5.4)
Installing Bolts 1.5.0 (was 1.2.0)
Using Countly (15.06.01)
Installing FBSDKCoreKit 4.8.0 (was 4.4.0)
Installing FBSDKLoginKit 4.8.0 (was 4.4.0)
Installing FBSDKShareKit 4.8.0 (was 4.4.0)
Installing GoogleMaps 1.10.5 (was 1.10.1)
Using MONActivityIndicatorView (0.0.3)
Using MagicalRecord (2.3.0)
Using NYXImagesKit (2.3)
Generating Pods project
Integrating client project
Sending stats
Sending stats
Pod installation complete! There are 9 dependencies from the Podfile and 10 total pods installed.
Please update your CocoaPods like below:
myComputer:desiredFolder Test$ pod update

Resources