Skip to content

Commit

Permalink
App extension shared application fix (#11605)
Browse files Browse the repository at this point in the history
  • Loading branch information
renkelvin authored Jul 25, 2023
1 parent 73c646a commit 3676437
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions FirebaseAuth/Sources/MultiFactor/TOTP/FIRTOTPSecret.m
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 3676437

Please sign in to comment.