2

I'm using Xcode 12.4 and I upgraded cocoapods to 1.10.1 and updated my all of my Firebase pods. Afterwards when I ran the project I kept getting an InstanceID() error. I then googled it and it turns out FirebaseInstanceID is deprecated and I had to use Firebase/Installations:

// add this to the podfile
pod 'Firebase/Installations'

$ pod install

After the Firebase/Installations update I kept getting the error:

FirebaseInstallations will not work correctly with current version of Firebase Instance ID. Please update your Firebase Instance ID version.

It didn't make any sense because FirebaseInstanceID is deprecated so how could I update it. I followed this GitHub thread which was of no help.

Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
  • 1
    Thanks for pointing this out. I sent a PR to improve the error message in https://github.com/firebase/firebase-ios-sdk/pull/8279 – Paul Beusterien Jun 20 '21 at 14:37

1 Answers1

1

I spent a couple of hours on this. I don't undestand why they have the error that says Please update your Firebase Instance ID version. To fix this issue I had to remove FirebaseInstanceID from my podfile

// add a # sign in front of FirebaseInstanceID inside your podfile
#pod 'FirebaseInstanceID'

// then run
$ pod install

Inside AppDelegate I had to remove the import FirebaseInstanceID library

import FirebaseInstanceID // delete this

To get the token I followed this answer https://stackoverflow.com/a/64248707/4833705:

Replace this deprecated method:

InstanceID.instanceID().instanceID { (result, error) in { }

With this:

Messaging.messaging().token { (token, error) in { }

Sidenote If you get errors you might have to delete and reinstall all of your pods but this shouldn't be necessary.

Make sure you make a copy of the Podfile before doing these steps.

$ sudo gem install cocoapods-deintegrate

$ sudo gem install cocoapods-deintegrate cocoapods-clean

$ rm -rf ~/Library/Developer/Xcode/DerivedData

$ pod deintegrate

$ pod clean

$ rm Podfile

$ pod cache clean --all

$ pod init

Open the new Podfile then add everything from the copy

Lance Samaria
  • 17,576
  • 18
  • 108
  • 256