Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 3ad4771

Browse files
Cloud Messaging: Not getting a token back on iOS #950
1 parent efd7976 commit 3ad4771

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/messaging/messaging.ios.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ export function addBackgroundRemoteNotificationHandler(appDelegate) {
162162

163163
appDelegate.prototype.applicationDidReceiveRemoteNotificationFetchCompletionHandler = (app, notification, completionHandler) => {
164164
// Pass notification to auth and check if they can handle it (in case phone auth is being used), see https://firebase.google.com/docs/auth/ios/phone-auth
165-
if (firebase._configured && FIRAuth.auth().canHandleNotification(notification)) {
166-
completionHandler(UIBackgroundFetchResult.NoData);
167-
return;
165+
if (typeof (FIRAuth) !== "undefined") {
166+
if (firebase._configured && FIRAuth.auth().canHandleNotification(notification)) {
167+
completionHandler(UIBackgroundFetchResult.NoData);
168+
return;
169+
}
168170
}
169171

170172
completionHandler(UIBackgroundFetchResult.NewData);

0 commit comments

Comments
 (0)