I want to make an app that opens many URL schemes.
To make it, I tried some ways:
I used
UIApplication.shared.open(url, options: [:], completionHandler: nil)
.
But this way I must add the URL scheme ininfo.plist
.
And ininfo.plist
I can add a maximum of 50 URL schemes.
(I want to add over 50 URL schemes)I tried using
WKWebView
.
But TheWKWebView
doesn't handle non-http URL schemas.
The webview only opens http, https.
I want to open over 50 URL schemes, what should I do?
CodePudding user response:
You can use SafariServices
framework. The code would look like that if you call it from some view controller:
if let url = URL(string: "<your_url>") {
let safariVC = SFSafariViewController(url: url)
present(safariVC, animated: true, completion: nil)
}
CodePudding user response:
I read this article about the 50 schemes limitation you have mentioned.
It says that you need to add the schemes only if you use canOpenURL (the system method that is called in order to check if the apps are installed on the device). So, maybe you can use another check instead of canOpenURL, and this way you don't need to add the schemes to info.plist
You can always check the Bool value that is passed to the completion handler of UIApplication.shared.open(...) in order to tell if the other app was opened or not.