From a8ebed8a0f93093afbe6bd244dadddd58c244a70 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 29 Aug 2024 11:35:35 +0200 Subject: [PATCH] Fix error when retrieving FCM token after updating to FCM 10.23 The first time the app starts it works fine, but after restarting the app the code calls initRegistration too soon and it fails. --- src/ios/PushPlugin.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ios/PushPlugin.m b/src/ios/PushPlugin.m index 58467a937..a4e5be0b8 100644 --- a/src/ios/PushPlugin.m +++ b/src/ios/PushPlugin.m @@ -381,6 +381,9 @@ - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { if(![weakSelf usesFCM]) { [weakSelf registerWithToken: token]; + } else { + // Obtain the FCM token now that the APNS token is available, otherwise initRegistation fails. + [weakSelf initRegistration]; } }];