How does I fix Nsurlerrordomain error-999 in IPhone 3.0 OS

Source: Internet
Author: User

Documents from Apple Inc.:

Nsurlerrorcancelled (-999)

"When asynchronous load cancellation is returned. The WEB Toolkit Framework delegate receives this error when it performs a cancel operation on the load resource. Note that nsurlconnection or nsurldownload delegates do not receive this error if the download is canceled. "

Therefore, the most likely scenario for this scenario is for you to load the request, and then load the other (or the same) before the first completion. This can happen, for example, if a call to loadRequest (or loadHTMLString ) Such a method viewDidAppear: can be called multiple times, or a quick return to the last viewed page; Quick click on the 2 link inUIWebView ...都会造成这样的问题出现。

The simplest way is to:

-(void) WebView: (UIWebView *) WebView didfailloadwitherror: (Nserror *) error{  //         NSLog (@ "%@", error);    if ([error code]! = nsurlerrorcancelled) {  // give error prompt     }}

The general recommendation is to review how well where you call loadRequest (or loadHTMLString ) and possibly provide some code.

To troubleshoot this problem, I recommend adding the following traces to your Web view delegate:

- (void) Webviewdidstartload: (UIWebView *) WebView {NSLog (@"starting to download request:%@", [WebView.request.URL absolutestring]);}- (void) Webviewdidfinishload: (UIWebView *) WebView {NSLog (@"finished downloading request:%@", [WebView.request.URL absolutestring]);}- (void) WebView: (UIWebView *) WebView didfailloadwitherror: (Nserror *) Error {if([error code] = =nsurlerrorcancelled) NSLog (@"Canceled Request:%@", [WebView.request.URL absolutestring]);}

If you check the output, you should see more clearly what's going on.

How does I fix Nsurlerrordomain error-999 in IPhone 3.0 OS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.