Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Add Xcode7 workaround for failing dynamic check in Xcode 7/sdk version 9. #24

Merged
merged 3 commits into from
May 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
homepage: https://github.com/flutter/plugins
Expand Down