aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging/FIRMessaging+FIRApp.m
diff options
context:
space:
mode:
authorGravatar Ryan Wilson <wilsonryan@google.com>2017-07-26 22:17:48 -0400
committerGravatar GitHub <noreply@github.com>2017-07-26 22:17:48 -0400
commit94dd3c50ad22533f97f59988a1dc01277f29ed6d (patch)
tree048f2e6278a6fe9c24368f6f9ea01e5098f2b8d7 /Firebase/Messaging/FIRMessaging+FIRApp.m
parentdec86df5539dcc6fc73085f14a180568e253398a (diff)
Configure Messaging for default FIRApp only. (#154)
Currently Messaging will use the most recent FIRApp configured which isn't obvious. This will limit it to only the defualt FIRApp.
Diffstat (limited to 'Firebase/Messaging/FIRMessaging+FIRApp.m')
-rw-r--r--Firebase/Messaging/FIRMessaging+FIRApp.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/Firebase/Messaging/FIRMessaging+FIRApp.m b/Firebase/Messaging/FIRMessaging+FIRApp.m
index b8adf14..50078bf 100644
--- a/Firebase/Messaging/FIRMessaging+FIRApp.m
+++ b/Firebase/Messaging/FIRMessaging+FIRApp.m
@@ -44,6 +44,14 @@
+ (void)didReceiveConfigureSDKNotification:(NSNotification *)notification {
NSDictionary *appInfoDict = notification.userInfo;
+ NSNumber *isDefaultApp = appInfoDict[kFIRAppIsDefaultAppKey];
+ if (![isDefaultApp boolValue]) {
+ // Only configure for the default FIRApp.
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeFIRApp001,
+ @"Firebase Messaging only works with the default app.");
+ return;
+ }
+
NSString *appName = appInfoDict[kFIRAppNameKey];
FIRApp *app = [FIRApp appNamed:appName];
[[FIRMessaging messaging] configureMessaging:app];