无法找到URL applewebdata的任何操作

Den*_*sov 9 objective-c hyperlink ios

我尝试打开在应用程序中点击的链接,如下所示:

- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)url inRange:(NSRange)characterRange
{

    UIApplication *myApp = [UIApplication sharedApplication];
    [myApp openURL:url];

    return YES;
}
Run Code Online (Sandbox Code Playgroud)

但结果却没有任何反应.

只是:找不到URL applewebdata的任何操作:// 10FC0C33-238E-481E-BF44-8D0BA2B1FBB7 /%22https://vk.com/feed/%22没有任何结果.

Ste*_*fan 2

我有这个确切的错误。问题是我声明了委托方法

    public func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool {
Run Code Online (Sandbox Code Playgroud)

在(Objective-C)类的(Swift)扩展中,但类头具有协议一致性声明。

当我将 UITextFieldDelegate 声明移至扩展时,一切都起作用了,其中委托方法是

extension MyViewController: UITextViewDelegate
Run Code Online (Sandbox Code Playgroud)