diff --git a/Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m b/Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m index be5dc820c..c49cbbf9c 100644 --- a/Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m +++ b/Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m @@ -145,7 +145,11 @@ - (BOOL)presentExternalUserAgentRequest:(nonnull id NSString *testURLString = [NSString stringWithFormat:@"%@://example.com", _canOpenURLScheme]; NSURL *testURL = [NSURL URLWithString:testURLString]; if (![[UIApplication sharedApplication] canOpenURL:testURL]) { - [[UIApplication sharedApplication] openURL:_appStoreURL]; + if (@available(iOS 10.0, *)) { + [[UIApplication sharedApplication] openURL:_appStoreURL options:@{} completionHandler:nil]; + } else { + [[UIApplication sharedApplication] openURL:_appStoreURL]; + } return NO; } } @@ -153,8 +157,14 @@ - (BOOL)presentExternalUserAgentRequest:(nonnull id // Transforms the request URL and opens it. NSURL *requestURL = [request externalUserAgentRequestURL]; requestURL = _URLTransformation(requestURL); - BOOL openedInBrowser = [[UIApplication sharedApplication] openURL:requestURL]; - return openedInBrowser; + if (@available(iOS 10.0, *)) { + BOOL willOpen = [[UIApplication sharedApplication] canOpenURL:requestURL]; + [[UIApplication sharedApplication] openURL:requestURL options:@{} completionHandler:nil]; + return willOpen; + } else { + BOOL openedInBrowser = [[UIApplication sharedApplication] openURL:requestURL]; + return openedInBrowser; + } } - (void)dismissExternalUserAgentAnimated:(BOOL)animated