Avoid using deprecated APIs on iOS 10.0+
Change-Id: Ic9dc6a24ef793a29c2652ad37bc11120e2e6ceef Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
parent
cb08b40976
commit
6486a4bd19
@ -177,6 +177,19 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
|
||||
still fail to launch or fail to open the requested URL. This result will not be reported back
|
||||
to the application.
|
||||
|
||||
\warning URLs passed to this function on iOS will not load unless their schemes are
|
||||
listed in the \c LSApplicationQueriesSchemes key of the application's Info.plist file.
|
||||
For more information, see the Apple Developer Documentation for
|
||||
\l{https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl}{canOpenURL(_:)}.
|
||||
For example, the following lines enable URLs with the HTTPS scheme:
|
||||
|
||||
\code
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
<array>
|
||||
<string>https</string>
|
||||
</array>
|
||||
\endcode
|
||||
|
||||
\sa setUrlHandler()
|
||||
*/
|
||||
bool QDesktopServices::openUrl(const QUrl &url)
|
||||
|
@ -55,11 +55,13 @@ bool QIOSServices::openUrl(const QUrl &url)
|
||||
return openDocument(url);
|
||||
|
||||
NSURL *nsUrl = url.toNSURL();
|
||||
UIApplication *application = [UIApplication sharedApplication];
|
||||
|
||||
if (![[UIApplication sharedApplication] canOpenURL:nsUrl])
|
||||
if (![application canOpenURL:nsUrl])
|
||||
return false;
|
||||
|
||||
return [[UIApplication sharedApplication] openURL:nsUrl];
|
||||
[application openURL:nsUrl options:@{} completionHandler:nil];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QIOSServices::openDocument(const QUrl &url)
|
||||
|
Loading…
Reference in New Issue
Block a user