首页 > 解决方案 > 修复类型“NSNotification.Name”的任何解决方案都没有成员“UITextField”错误?

问题描述

我最近安装了一个名为“NumericKeyboard”的 pod,并收到以下错误。我已经在这里待了 2 个小时,所以任何帮助都将不胜感激。

错误 #1:类型“NSNotification.Name”没有成员“UITextField”

NotificationCenter.default.post(name: NSNotification.Name.UITextField.textDidChangeNotification, object: self.textView)

错误 #2:类型 'NSNotification.Name' 没有成员 'UITextView'

NotificationCenter.default.post(name: NSNotification.Name.UITextView.textDidChangeNotification, object: self.textView)

标签: swiftuitextfield

解决方案


它应该是

NotificationCenter.default.post(name: UITextView.textDidChangeNotification, 
                              object: self.textView)

推荐阅读