【发布时间】:2016-07-07 13:15:58
【问题描述】:
当我在我的 swift 类中实现 func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool 或 func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool 方法时,它会给出如下所示的错误和警告。
错误:Use of undeclared type 'URL'
警告:Instance method 'textView(_:shouldInteractWith:in:)' nearly matches optional requirement 'textView(_:shouldInteractWith:in:)' of protocol 'UITextViewDelegate'
如果我将类名更改为NSURL 而不是URL,它会正确编译,但警告永远不会响起。
在我的 textView 中与 URL 交互时也不会调用上述方法
谢谢!
【问题讨论】: