From 367643716b7faeba73d82a1c7f399dff8b589b8a Mon Sep 17 00:00:00 2001 From: renkelvin Date: Tue, 25 Jul 2023 16:27:33 -0700 Subject: [PATCH] App extension shared application fix (#11605) --- .../Sources/MultiFactor/TOTP/FIRTOTPSecret.m | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/FirebaseAuth/Sources/MultiFactor/TOTP/FIRTOTPSecret.m b/FirebaseAuth/Sources/MultiFactor/TOTP/FIRTOTPSecret.m index 53751704b9e..8675b336b79 100644 --- a/FirebaseAuth/Sources/MultiFactor/TOTP/FIRTOTPSecret.m +++ b/FirebaseAuth/Sources/MultiFactor/TOTP/FIRTOTPSecret.m @@ -72,14 +72,17 @@ - (void)openInOTPAppWithQRCodeURL:(NSString *)QRCodeURL { } UIApplication *application = [applicationClass sharedApplication]; if (application) { - if ([application respondsToSelector:@selector(canOpenURL:)]) { - if ([application canOpenURL:url]) { - [application openURL:url options:@{} completionHandler:nil]; + if ([application canOpenURL:url]) { + SEL selector = @selector(openURL:options:completionHandler:); + if ([application respondsToSelector:selector]) { + IMP imp = [application methodForSelector:selector]; + void (*func)(id, SEL, NSURL *, NSDictionary *, void (^)(BOOL)) = (void *)imp; + func(application, selector, url, @{}, nil); } else { - NSLog(@"URL cannot be opened"); + NSLog(@"Cannot access openURL:options:completionHandler: method"); } } else { - NSLog(@"Cannot access canOpenURL: method"); + NSLog(@"URL cannot be opened"); } } else { NSLog(@"sharedApplication cannot be accessed");