Skip to content

Commit 3676437

Browse files
author
renkelvin
authored
App extension shared application fix (#11605)
1 parent 73c646a commit 3676437

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

FirebaseAuth/Sources/MultiFactor/TOTP/FIRTOTPSecret.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,17 @@ - (void)openInOTPAppWithQRCodeURL:(NSString *)QRCodeURL {
7272
}
7373
UIApplication *application = [applicationClass sharedApplication];
7474
if (application) {
75-
if ([application respondsToSelector:@selector(canOpenURL:)]) {
76-
if ([application canOpenURL:url]) {
77-
[application openURL:url options:@{} completionHandler:nil];
75+
if ([application canOpenURL:url]) {
76+
SEL selector = @selector(openURL:options:completionHandler:);
77+
if ([application respondsToSelector:selector]) {
78+
IMP imp = [application methodForSelector:selector];
79+
void (*func)(id, SEL, NSURL *, NSDictionary *, void (^)(BOOL)) = (void *)imp;
80+
func(application, selector, url, @{}, nil);
7881
} else {
79-
NSLog(@"URL cannot be opened");
82+
NSLog(@"Cannot access openURL:options:completionHandler: method");
8083
}
8184
} else {
82-
NSLog(@"Cannot access canOpenURL: method");
85+
NSLog(@"URL cannot be opened");
8386
}
8487
} else {
8588
NSLog(@"sharedApplication cannot be accessed");

0 commit comments

Comments
 (0)