Skip to content

Commit

Permalink
Add Xcode7 workaround for failing dynamic check in Xcode 7/sdk versio…
Browse files Browse the repository at this point in the history
…n 9. (flutter#24)
  • Loading branch information
szakarias committed May 8, 2017
1 parent 4df802b commit 7c65935
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions packages/url-launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 8 additions & 6 deletions packages/url-launcher/ios/Classes/UrlLauncherPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/url-launcher/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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 <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins
Expand Down

0 comments on commit 7c65935

Please sign in to comment.