Flutter-permission-handler: 2.1.1 swift compilation error

Created on 21 Nov 2018  路  1Comment  路  Source: Baseflow/flutter-permission-handler

My project doesn't compile anymore because of this:

/Users/jaumard/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:50:108: error: cannot convert value of type '[UIApplication.OpenExternalURLOptionsKey : Any]' (aka 'Dictionary<NSString, Any>') to expected argument type '[String : Any]'
                    UIApplication.shared.open(URL.init(string: UIApplication.openSettingsURLString)!, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]),
                                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                                                                                              as [String : Any]
    /Users/jaumard/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:55: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/jaumard/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:95: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 

Do I need to update something on iOS side ?

Version: 2.1.1

Platform:
iOS

Most helpful comment

migrate to swift 4.2 fix everything

>All comments

migrate to swift 4.2 fix everything

Was this page helpful?
0 / 5 - 0 ratings