Skip to content

Commit 53c2fff

Browse files
smilesa-maurice
authored andcommitted
Fixed forwarding to swizzled method in Instance ID on iOS.
When importing the Instance ID C++ SDK the swizzling of application:didRegisterForRemoteNotificationsWithDeviceToken: would no longer call the swizzled out method. This fixes this to forward to the original implementation. PiperOrigin-RevId: 248783081
1 parent 3eb04f1 commit 53c2fff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

instance_id/src/ios/instance_id.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@ static void AppDelegateApplicationDidRegisterForRemoteNotificationsWithDeviceTok
111111
id self, SEL selector_value, UIApplication *application, NSData *device_token) {
112112
LogDebug("Caching device token");
113113
g_device_token = device_token;
114+
IMP app_delegate_application_did_register_for_remote_notifications_with_device_token =
115+
SwizzledMethodCache().GetMethodForObject(
116+
self, @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:));
117+
if (app_delegate_application_did_register_for_remote_notifications_with_device_token) {
118+
((util::AppDelegateApplicationDidRegisterForRemoteNotificationsWithDeviceTokenFunc)
119+
app_delegate_application_did_register_for_remote_notifications_with_device_token)(
120+
self, selector_value, application, device_token);
121+
}
114122
}
115123
// Hook all AppDelegate methods that IID requires to cache data for token fetch operations.
116124
//

0 commit comments

Comments
 (0)