-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
Hi all,
We are experiencing a weird token retrieval issue with error Failed to get instance FirebaseID when calling FCM.getToken() on iOS. Coming from:
Line 67 in 2cbc916
| call.reject("Failed to get instance FirebaseID", error.localizedDescription) |
Does anybody have an idea what can be the cause of this error(I understand it could be many things) and is there anything that can be done?
The Android at the same time has no issue, only iOS it getting the error.
The AppDelegate.swift file is configured according to documentation https://capacitorjs.com/docs/guides/push-notifications-firebase#ios:
import UIKit
import Capacitor
import FirebaseCore
import FirebaseMessaging
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
//... other methods ...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
Messaging.messaging().token(completion: { (token, error) in
if let error = error {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
} else if let token = token {
NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: token)
}
})
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
}
With Podfile correctly containing FirebaseMessaging pod dependency:
target 'App' do
capacitor_pods
# Add your Pods here
pod 'FirebaseMessaging'
endCould it be that we are still missing something in the configuration and thus Firebase not getting instantiated properly?
Metadata
Metadata
Assignees
Labels
No labels