How to solve Capacitor error: no such module ‘FirebaseInstanceID’
If you are building your iOS app in Capacitor or Ionic framework with Capacitor, you have likely encountered the following error:
ios/App/App/AppDelegate.swift:4:8: error: no such module 'FirebaseInstanceID'
The problem
If you have implemented Firebase Cloud Messaging for notifications, you had to add FirebaseInstanceID
package in order to receive a FCM token. You also had to add the following code to your AppDelegate.swift
file:
The problem is that FirebaseInstanceID
has recently became deprecated, so the above code is no longer working with the new version.
The solution
FCM token is now provided directly on the Messaging
instance. Modify the code above in your AppDelegate.swift
to match the one below.
The last thing is to remove FirebaseInstanceID
import from your AppDelegate.swift
. Simply remove the…