iOSDropDown:类型“ UIResponder”没有成员“ NSNotification”

时间:2019-10-13 07:45:01

标签: swift xcode

更新为Catalina之后,pod update出现错误

  

类型“ UIResponder”没有成员“ NSNotification”

这是为iOSDropDown

if isSearchEnable && handleKeyboard{
        NotificationCenter.default.addObserver(forName: UIResponder.NSNotification.Name.UIKeyboardWillShow, object: nil, queue: nil) { (notification) in
            if self.isFirstResponder{
            let userInfo:NSDictionary = notification.userInfo! as NSDictionary
                let keyboardFrame:NSValue = userInfo.value(forKey: UIResponder.UIKeyboardFrameEndUserInfoKey) as! NSValue
            let keyboardRectangle = keyboardFrame.cgRectValue
            self.keyboardHeight = keyboardRectangle.height
                if !self.isSelected{
                    self.showList()
                }
            }

        }
        NotificationCenter.default.addObserver(forName: UIResponder.NSNotification.Name.UIKeyboardWillHide, object: nil, queue: nil) { (notification) in
            if self.isFirstResponder{
            self.keyboardHeight = 0
            }
        }
    }

1 个答案:

答案 0 :(得分:1)

您现在将直接在类型属性

下的here上在keyboardWillShowNotification上使用UIResponder
NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillShowNotification, object: nil, queue: nil)

注意:由于该错误位于外部库中,因此您可以fork修复该库,然后指向podfile中的分叉版本。或者,您可以选择在本地计算机上进行更改,但是每次执行pod update时,这些更改都会被覆盖。