views:

1369

answers:

2

Hello,

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.

A: 

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

Atagyz
A: 

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 !

xKobal