Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error on iOS #168

Closed
deisold opened this issue Jan 15, 2019 · 3 comments
Closed

Compile error on iOS #168

deisold opened this issue Jan 15, 2019 · 3 comments

Comments

@deisold
Copy link

deisold commented Jan 15, 2019

πŸ› Bug Report

There are various warnings causing build failure when adding geolocator: ^2.1.1 to the project and targeting iOS.

Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **

Xcode's output:
↳
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:50:59: error: 'openSettingsURLString' has been renamed to 'UIApplicationOpenSettingsURLString'
guard let url = URL(string: UIApplication.openSettingsURLString),
^~~~~~~~~~~~~~~~~~~~~
UIApplicationOpenSettingsURLString
UIKit.UIApplication:64:22: note: 'openSettingsURLString' was introduced in Swift 4.2
public class let openSettingsURLString: String
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:55:45: error: argument labels '(rawValue:)' do not match any available overloads
let optionsKeyDictionary = [UIApplication.OpenExternalURLOptionsKey(rawValue: "universalLinksOnly"): NSNumber(value: true)]
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:55:45: note: overloads for 'UIApplication.OpenExternalURLOptionsKey' exist with these partially matching parameter lists: (coder: NSCoder), (stringLiteral: StaticString), (format: NSString, CVarArg...), (string: NSString), (utf8String: UnsafePointer), (UTF8String: UnsafePointer), (string: String), (contentsOfFile: String), (contentsOf: URL), (contentsOfURL: URL), (cString: UnsafePointer), (CString: UnsafePointer)
let optionsKeyDictionary = [UIApplication.OpenExternalURLOptionsKey(rawValue: "universalLinksOnly"): NSNumber(value: true)]
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:59:91: error: 'openSettingsURLString' has been renamed to 'UIApplicationOpenSettingsURLString'
let success = UIApplication.shared.openURL(URL.init(string: UIApplication.openSettingsURLString)!)
^~~~~~~~~~~~~~~~~~~~~
UIApplicationOpenSettingsURLString
UIKit.UIApplication:64:22: note: 'openSettingsURLString' was introduced in Swift 4.2
public class let openSettingsURLString: String
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:99:54: error: closure tuple parameter '(key: String, value: Any)' does not support destructuring
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
^~~~~~~~~~
(arg) -> <#Result#> let (key, value) = arg; return
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:27:31: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
- (void)safariViewController:(SFSafariViewController *)controller
^
In module 'SafariServices' imported from /Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:5:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
@interface SFSafariViewController : UIViewController
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:27:1: note: annotate 'safariViewController:didCompleteInitialLoad:' with an availability attribute to silence this warning
- (void)safariViewController:(SFSafariViewController *)controller
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:43:40: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
- (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
^
In module 'SafariServices' imported from /Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:5:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
@interface SFSafariViewController : UIViewController
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:43:1: note: annotate 'safariViewControllerDidFinish:' with an availability attribute to silence this warning
- (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
^
API_AVAILABLE(ios(9.0))
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:29:31: warning: comparison between pointer and integer ('NSInteger' (aka 'long') and 'void *')
if (_previousStatusBarStyle != nil) {
~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:111:45: warning: comparison between pointer and integer ('NSInteger' (aka 'long') and 'void ')
if (self->_previousStatusBarStyle != nil) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:108:18: warning: 'openURL:options:completionHandler:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
[application openURL:url
^~~~~~~~~~~
In module 'UIKit' imported from /Volumes/PROJECTS/nomadradar-app/repo/nomadradar/ios/Pods/Target Support Files/url_launcher/url_launcher-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:135:1: note: 'openURL:options:completionHandler:' has been explicitly marked partial here
- (void)openURL:(NSURL
)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS("");
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:108:18: note: enclose 'openURL:options:completionHandler:' in an @available check to silence this warning
[application openURL:url
^~~~~~~~~~~
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:140:3: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
^~~~~~~~~~~~~~~~~~~~~~
In module 'SafariServices' imported from /Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:5:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
@interface SFSafariViewController : UIViewController
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:140:3: note: enclose 'SFSafariViewController' in an @available check to silence this warning
SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
^~~~~~~~~~~~~~~~~~~~~~
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:140:38: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
^~~~~~~~~~~~~~~~~~~~~~
In module 'SafariServices' imported from /Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:5:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
@interface SFSafariViewController : UIViewController
^
/Users/dirkeisold/programming/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-3.0.3/ios/Classes/UrlLauncherPlugin.m:140:38: note: enclose 'SFSafariViewController' in an @available check to silence this warning
SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];

Expected behavior

No errors.

Reproduction steps

Configuration

Version: ^2.1.1

[βœ“] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G4015, locale de-DE)
β€’ Flutter version 1.0.0 at /Users/dirkeisold/programming/flutter
β€’ Framework revision 5391447fae (7 weeks ago), 2018-11-29 19:41:26 -0800
β€’ Engine revision 7375a0f414
β€’ Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[βœ“] Android toolchain - develop for Android devices (Android SDK 28.0.3)
β€’ Android SDK at /Users/dirkeisold/programming/android-sdk-macosx
β€’ Android NDK location not configured (optional; useful for native profiling support)
β€’ Platform android-28, build-tools 28.0.3
β€’ ANDROID_HOME = /Users/dirkeisold/programming/android-sdk-macosx
β€’ Java binary at: /Applications/Android Studio 3.2.app/Contents/jre/jdk/Contents/Home/bin/java
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
β€’ All Android licenses accepted.

[βœ“] iOS toolchain - develop for iOS devices (Xcode 10.1)
β€’ Xcode at /Applications/Xcode.app/Contents/Developer
β€’ Xcode 10.1, Build version 10B61
β€’ ios-deploy 2.0.0
β€’ CocoaPods version 1.5.3

@tommaso1
Copy link

+1

@tsjly
Copy link

tsjly commented Jan 22, 2019

try flutter cleanflutter clean

@mvanbeusekom
Copy link
Member

@deisold, @tommaso1, the reason you are getting this issue is probably because you are still compiling against an older SWIFT version (I believe the current default is 4.1). You can simply change this by updating your Podfile using the following instructions.

In your Podfile make sure you add the line use_frameworks! (best is to add this line directly below the target Runner do like so:

target 'Runner' do
  use_frameworks!

Also in your Podfile make sure you add the line config.build_settings['SWIFT_VERSION'] = '4.2' to the post_installer block. After adding this line the post_installer block should look like this:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['SWIFT_VERSION'] = '4.2'
    end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants