aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
diff options
context:
space:
mode:
authorGravatar Chen Liang <chliang@google.com>2018-07-09 14:33:41 -0700
committerGravatar GitHub <noreply@github.com>2018-07-09 14:33:41 -0700
commit954e4d5df13b14aee9c1112db67a23729d12acfd (patch)
treedebab82666deb5d7ff1e99d55f5dba749db1ffb1 /Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
parentbd69fae81077dd1107e4abe8a8722cb3d8a5fb29 (diff)
avoid calling [UIApplication sharedApplication] in app extensions (#1503)
Diffstat (limited to 'Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m')
-rw-r--r--Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m7
1 files changed, 6 insertions, 1 deletions
diff --git a/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m b/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
index c5ad337..7cea178 100644
--- a/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
+++ b/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
@@ -21,6 +21,7 @@
#import "FIRMessagingConstants.h"
#import "FIRMessagingLogger.h"
+#import "FIRMessagingUtilities.h"
#import "FIRMessaging_Private.h"
static const BOOL kDefaultAutoRegisterEnabledValue = YES;
@@ -98,7 +99,11 @@ static NSString *kReceiveDataMessageSelectorString = @"messaging:didReceiveMessa
return;
}
- NSObject<UIApplicationDelegate> *appDelegate = [[UIApplication sharedApplication] delegate];
+ UIApplication *application = FIRMessagingUIApplication();
+ if (!application) {
+ return;
+ }
+ NSObject<UIApplicationDelegate> *appDelegate = [application delegate];
[self swizzleAppDelegateMethods:appDelegate];
// Add KVO listener on [UNUserNotificationCenter currentNotificationCenter]'s delegate property