-1

I have a UIWebView just on a View and when I cliked in a link, I launch this view with a good content.

NSLog(@"---> %@",url);

NSURL *websiteUrlL = [NSURL URLWithString:url];
NSURLRequest *urlRequestT = [NSURLRequest requestWithURL:websiteUrlL];

NSLog(@"---> %@",urlRequestT);

In my Output I have

  • url : is good with http:// URL .php
  • urlRequestT : is good with : { URL: http:// URL .php }
(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    NSLog(@"Error %li", (long)error.code);
    if (error.code == NSURLErrorCancelled) return; // this is Error -999
        NSLog(@"Canceled request: %@", [webView.request.URL absoluteString]);
}

In my Output Error I have the number -999

I don't know why my page doesn't load with this type of file... My UiWebView works fine with a simple html file Thanks for advance.

I finished to find the good answer, the better place for load content in UIWebView is in viewDidAppear not in viewDidLoad

Pierre_S
  • 73
  • 3
  • 13
  • What is the ending of your last sentence ("I don't")? And if the error is "`NSURLErrorCancelled`", might this be the server that's telling the requesting process (i.e. your app) that the loading has been cancelled? – Michael Dautermann Apr 16 '14 at 12:44
  • 2
    When I search this site for 'NSURLErrorCancelled', I get 67 answers. Do any of them apply to your situation? – Phillip Mills Apr 16 '14 at 12:46
  • http://stackoverflow.com/questions/1024748/how-do-i-fix-nsurlerrordomain-error-999-in-iphone-3-0-os follow this link – karan Apr 16 '14 at 12:46
  • @PhillipMills Nothing resolve my issue, that why I create this post... – Pierre_S Apr 16 '14 at 13:02

1 Answers1

0

i think you are having escape sequences in url try loading webview with this

url  = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSURL *websiteUrlL = [NSURL URLWithString:url];
NSURLRequest *urlRequestT = [NSURLRequest requestWithURL:websiteUrlL];
NSLog(@"---> %@",urlRequestT);
ShujatAli
  • 1,376
  • 2
  • 14
  • 26