From 7c65935487ce679559dcf9b5206e6d1117b0b36d Mon Sep 17 00:00:00 2001 From: Sarah Zakarias Date: Mon, 8 May 2017 15:06:04 +0200 Subject: [PATCH] Add Xcode7 workaround for failing dynamic check in Xcode 7/sdk version 9. (#24) --- packages/url-launcher/CHANGELOG.md | 4 ++++ .../url-launcher/ios/Classes/UrlLauncherPlugin.m | 14 ++++++++------ packages/url-launcher/pubspec.yaml | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/url-launcher/CHANGELOG.md b/packages/url-launcher/CHANGELOG.md index 5b9b6049b568..838b8600b5ca 100644 --- a/packages/url-launcher/CHANGELOG.md +++ b/packages/url-launcher/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.3.5] - 2017-05-8 + +* Workaround for failing dynamic check in Xcode 7/sdk version 9. + ## [0.3.4] - 2017-05-08 * Add test. diff --git a/packages/url-launcher/ios/Classes/UrlLauncherPlugin.m b/packages/url-launcher/ios/Classes/UrlLauncherPlugin.m index 4bea2265c757..b52fa24184c8 100644 --- a/packages/url-launcher/ios/Classes/UrlLauncherPlugin.m +++ b/packages/url-launcher/ios/Classes/UrlLauncherPlugin.m @@ -35,16 +35,18 @@ - (BOOL)canLaunchURL:(NSString*)urlString { } - (void)launchURL:(NSString*)urlString result:(FlutterResult)result { - NSURL* url = [NSURL URLWithString:urlString]; - UIApplication* application = [UIApplication sharedApplication]; - if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) { - // iOS 10 and above + NSURL* url = [NSURL URLWithString:urlString]; + UIApplication* application = [UIApplication sharedApplication]; + + // Using ifdef as workaround to support running with Xcode 7.0 and sdk version 9 + // where the dynamic check fails. +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0 [application openURL:url options:@{} completionHandler: ^(BOOL success) { [self sendResult:success result:result url:url]; }]; - } else { +#else [self sendResult:[application openURL:url] result:result url:url]; - } +#endif } - (void)sendResult:(BOOL)success result:(FlutterResult)result url:(NSURL*)url { diff --git a/packages/url-launcher/pubspec.yaml b/packages/url-launcher/pubspec.yaml index 2cd2b7a32ecc..4fedf76e7889 100644 --- a/packages/url-launcher/pubspec.yaml +++ b/packages/url-launcher/pubspec.yaml @@ -1,6 +1,6 @@ name: url_launcher -version: 0.3.4 +version: 0.3.5 description: A Flutter plugin for launching a URL author: Flutter Team homepage: https://github.com/flutter/plugins