From 38cc5e2299c3af2ac6c297ccf8f329019b323c98 Mon Sep 17 00:00:00 2001 From: fchan Date: Wed, 6 Sep 2017 16:49:55 -0400 Subject: [PATCH] adding ios 10 support --- src/ios/Launcher.m | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ios/Launcher.m b/src/ios/Launcher.m index 21e11bc..514cc3a 100644 --- a/src/ios/Launcher.m +++ b/src/ios/Launcher.m @@ -30,9 +30,24 @@ - (void)launch:(CDVInvokedUrlCommand*)command { NSString *uri = [options objectForKey:@"uri"]; if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:uri]]) { NSURL *launchURL = [NSURL URLWithString:uri]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + [[UIApplication sharedApplication] openURL:launchURL options:@{} completionHandler:^(BOOL success) { + CDVPluginResult * pluginResult = nil; + if (success) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + } + else + { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No app installed that can handle that uri."]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + } + }]; +#else [[UIApplication sharedApplication] openURL: launchURL]; pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +#endif } else { pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No app installed that can handle that uri."]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; @@ -42,5 +57,4 @@ - (void)launch:(CDVInvokedUrlCommand*)command { [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } } - -@end +@end \ No newline at end of file