5

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 code:

- (void)viewDidLoad {
 [super viewDidLoad];

 if (self.url != nil) {
  NSURL *requestUrl = [NSURL URLWithString:self.url];
  NSURLRequest *requestObj = [NSURLRequest requestWithURL:requestUrl];
  [webView loadRequest:requestObj];
 }
}

The url is setted by the parent controller.

When the URL comes directly from the RSS, I have an error in log:

[2234:207] Error Domain=WebKitErrorDomain Code=101 UserInfo=0x3a6a240 "Operation could not be completed. (WebKitErrorDomain error 101.)"

When I set manually the URL with the same URL like below, it work !

self.url = @"http://www.presence-pc.com/tests/fraude-financiere-paget-macafee-23198/#xtor=RSS-12";

Here is an URL exemple: http://www.presence-pc.com/tests/fraude-financiere-paget-macafee-23198/#xtor=RSS-12. I have no idea about that problem.

I hope you can help me.

Best regards.

4
  • Can we get more info about the URL that's coming from RSS? What format does it take? Commented Oct 6, 2009 at 21:14
  • 1
    Check the URL with NSLog() and then copy it and paste it into Safari and see if it loads. Commented Oct 6, 2009 at 21:50
  • How are you declaring your url property? Commented Oct 6, 2009 at 22:52
  • The reason failed is that NSURL converts "#" to "%23", so you can not access the URL you pointed. Commented Jul 15, 2011 at 2:44

3 Answers 3

2

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 !

Sign up to request clarification or add additional context in comments.

Comments

1

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];

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.