IsaiasSantana / keyboard_utils

A Flutter plugin to check keyboard visibility.
MIT License
49 stars 52 forks source link

xcode 11.3 errors keyboardWillShowNotification has been renamed to NSNotification.Name.UIKeyboardWillShow #14

Closed tcnesham closed 4 years ago

tcnesham commented 4 years ago

I don't have keyboard_utils in my pubspec.yaml so anther plugin must be pulling it in. I'm seeing the errors below in both InteliJ and Xcode 11.3. Can you put a fix out?


                                                   name: UIResponder.keyboardWillShowNotification,
                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                     NSNotification.Name.UIKeyboardWillShow
    UIKit.UIResponder:3:22: note: 'keyboardWillShowNotification' was introduced in Swift 4.2
        public class let keyboardWillShowNotification: NSNotification.Name
                         ^
    /Users/tim/.pub-cache/hosted/pub.dartlang.org/keyboard_utils-1.2.0/ios/Classes/SwiftKeyboardUtilsPlugin.swift:54:66: error: 'keyboardWillHideNotification' has been renamed to 'NSNotification.Name.UIKeyboardWillHide'
                                                   name: UIResponder.keyboardWillHideNotification,
                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                     NSNotification.Name.UIKeyboardWillHide
    UIKit.UIResponder:7:22: note: 'keyboardWillHideNotification' was introduced in Swift 4.2
        public class let keyboardWillHideNotification: NSNotification.Name
                         ^
    /Users/tim/.pub-cache/hosted/pub.dartlang.org/keyboard_utils-1.2.0/ios/Classes/SwiftKeyboardUtilsPlugin.swift:59:66: error: 'keyboardDidShowNotification' has been renamed to 'NSNotification.Name.UIKeyboardDidShow'
                                                   name: UIResponder.keyboardDidShowNotification,
                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                     NSNotification.Name.UIKeyboardDidShow
    UIKit.UIResponder:5:22: note: 'keyboardDidShowNotification' was introduced in Swift 4.2
        public class let keyboardDidShowNotification: NSNotification.Name
                         ^
    /Users/tim/.pub-cache/hosted/pub.dartlang.org/keyboard_utils-1.2.0/ios/Classes/SwiftKeyboardUtilsPlugin.swift:73:80: error: 'keyboardFrameEndUserInfoKey' has been renamed to 'UIKeyboardFrameEndUserInfoKey'
                if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue {
                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                   UIKeyboardFrameEndUserInfoKey
    UIKit.UIResponder:15:22: note: 'keyboardFrameEndUserInfoKey' was introduced in Swift 4.2
        public class let keyboardFrameEndUserInfoKey: String```
IsaiasSantana commented 4 years ago

Hi @tcnesham, what is your swift project version? Try update to Swift 5. Similar to #13 .

tcnesham commented 4 years ago

I tried Swift 5, but now get an error in FlutterAppDelegate 'UIApplicationLaunchOptionsKey' has been renamed to 'UIApplication.LaunchOptionsKey'

tcnesham commented 4 years ago

I fixed the FlutterAppDelegate code in iOS and it works... Thanks for your help!

IsaiasSantana commented 4 years ago

You are welcome. Closing the issue.