aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Firebase/Messaging/FIRMMessageCode.h1
-rw-r--r--Firebase/Messaging/FIRMessaging+FIRApp.m8
2 files changed, 9 insertions, 0 deletions
diff --git a/Firebase/Messaging/FIRMMessageCode.h b/Firebase/Messaging/FIRMMessageCode.h
index d0e91a3..7a2a8c5 100644
--- a/Firebase/Messaging/FIRMMessageCode.h
+++ b/Firebase/Messaging/FIRMMessageCode.h
@@ -19,6 +19,7 @@
typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
// FIRMessaging+FIRApp.m
kFIRMessagingMessageCodeFIRApp000 = 1000, // I-FCM001000
+ kFIRMessagingMessageCodeFIRApp001 = 1001, // I-FCM001001
// FIRMessaging.m
kFIRMessagingMessageCodeMessaging000 = 2000, // I-FCM002000
kFIRMessagingMessageCodeMessaging001 = 2001, // I-FCM002001
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];