aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
diff options
context:
space:
mode:
authorGravatar Riz <rsattar@gmail.com>2017-05-23 15:16:02 -0700
committerGravatar GitHub <noreply@github.com>2017-05-23 15:16:02 -0700
commitf67c074ed154e6ce2cfd949cc797e7cc7b72490f (patch)
treecdeb0641c01eef3a332e3bf2cf7f3217df680eec /Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
parentfaf445535330b7f0fe0330636c5e996005cb5555 (diff)
Log an error if for some reason we can't add a method to a class (#24)
Maybe it was already swizzled, or some other issue. Either way, it would be good to log this error, as it might help us / developers diagnose an issue.
Diffstat (limited to 'Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m')
-rw-r--r--Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m14
1 files changed, 10 insertions, 4 deletions
diff --git a/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m b/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
index 5432c79..214bd41 100644
--- a/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
+++ b/Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
@@ -368,10 +368,16 @@ static NSString *kUserNotificationWillPresentSelectorString =
struct objc_method_description method_description =
protocol_getMethodDescription(protocol, originalSelector, NO, YES);
- class_addMethod(klass,
- originalSelector,
- swizzledImplementation,
- method_description.types);
+ BOOL methodAdded = class_addMethod(klass,
+ originalSelector,
+ swizzledImplementation,
+ method_description.types);
+ if (!methodAdded) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeRemoteNotificationsProxyMethodNotAdded,
+ @"Could not add method for %@ to class %@",
+ NSStringFromSelector(originalSelector),
+ NSStringFromClass(klass));
+ }
}
[self trackSwizzledSelector:originalSelector ofClass:klass];
}