UIWebView: Error while loading URL

后端 未结 3 605
隐瞒了意图╮
隐瞒了意图╮ 2021-01-18 20:46

I am trying to build an RSS reader for the Tom\'s Hardware website.

I have an error when I try to load an URL into an UIWebview from an RSS link.

Here\'is my

相关标签:
3条回答
  • 2021-01-18 21:11

    I have this code which also triggers error code 101

     _request = [NSURLRequest requestWithURL:[NSURL URLWithString:redirectUrl]];
                [editorWebView loadRequest:_request];
    

    RedirectURL is an NSString which has this format http%3A%2F%2Fwww.linkedin.com%2Fnhome%2F

    I tried removing percent escapes using the method of NSString and it now works.

    [redirectUrl stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    0 讨论(0)
  • 2021-01-18 21:26

    I think the problem can be the anchor in your URL, a friend got the same problem

    0 讨论(0)
  • 2021-01-18 21:31

    Thanks guy, that'it, I have split the URL like this:

    NSArray *split = [url componentsSeparatedByString:@"#"];

    NSURL *requestUrl = [NSURL URLWithString:[[split objectAtIndex:0] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    

    and now it work , thanks for your help !

    0 讨论(0)
提交回复
热议问题