Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8154601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:24:28+00:00 2026-06-06T16:24:28+00:00

I have this set of code which was working fine about an hour or

  • 0

I have this set of code which was working fine about an hour or so ago. Then when I tried to launch it again few min back, the UIWebView just display a white screen. But if now I blocked out the -(bool) method, the viewDidLoad will occur. (tested with the NSLog) May I ask what happened to the code?? It was working and suddenly it stop functioning.

.m

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {

    NSString *titleString = @"Error Loading Page";
    NSString *messageString = [error localizedDescription];
    NSString *moreString = [error localizedFailureReason] ?
    [error localizedFailureReason] :
    NSLocalizedString(@"Try typing the URL again.", nil);
    messageString = [NSString stringWithFormat:@"%@. %@", messageString, moreString];

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:titleString
                                                        message:messageString delegate:self
                                              cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
    [alertView show];

}

if i implement the above method, the app when open UIWebView will constant pop up saying error domain error -999 non stop.

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSString *currentURL = [[request URL] absoluteString];
    NSRange range1= [currentURL rangeOfString:@"news"];
    NSRange range2= [currentURL rangeOfString:@"pdf"];
    if (range1.location == NSNotFound)
    {
        NSURL *url = [NSURL URLWithString:@"http://www.imc.jhmi.edu/news.html"];
        [webView loadRequest:[NSURLRequest requestWithURL:url]];

        return YES;
    }
    if(range2.location==NSNotFound)
    {
        NSURL * url = [NSURL URLWithString:@"http://www.imc.jhmi.edu/news.html"];
        [webView loadRequest:[NSURLRequest requestWithURL:url]];
        return YES;
    }

    return NO;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    webView.scalesPageToFit=YES;
    webView.delegate = self;

    NSString *urlAddress = @"http://www.imc.jhmi.edu/news.html";
    NSURL *url =[NSURL URLWithString:urlAddress];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestObj];
    NSLog(@"sadfasdf");
}

.h
@interface ViewController : UIViewController{
IBOutlet UIWebView*webView;
}

@property(nonatomic,strong) UIWebView*webView;

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:24:30+00:00Added an answer on June 6, 2026 at 4:24 pm

    When you load a request, the delegate method

    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
    

    will get called.

    In that method, you are trying to reload the same page for infinite number of times.

    Error Domain=NSURLErrorDomain Code=-999 “The operation couldn’t be completed. (NSURLErrorDomain error -999.)” UserInfo=0xe203e80 {NSErrorFailingURLKey=http://www.imc.jhmi.edu/news.html, NSErrorFailingURLStringKey=http://www.imc.jhmi.edu/news.html}

    I tried your code and got this error. This error may occur if another request is made before the previous request of the WebView is completed. So try to avoid those conditions in the delegate method repeating loading request.

    if(range2.location==NSNotFound)
    

    This condition will be always true.

    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
    {
        NSString *currentURL = [[request URL] absoluteString];
        NSRange range1= [currentURL rangeOfString:@"news"];
        if (range1.location == NSNotFound)
        {
            NSURL *url = [NSURL URLWithString:@"http://www.imc.jhmi.edu/news.html"];
            [webView loadRequest:[NSURLRequest requestWithURL:url]];
            return YES;
        }
    
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code which draws a Window and NSView, and have set up
I have this code that is working fine for me: using System; using System.Collections.Generic;
I have this banner rotator which is working fine except for one problem... This
I have set up a MapView Class which has Overlays (and they're working fine.)
I have this code to set up and check a cookie, and before a
I have this code, i'm trying to set the identity seed by a varable
I have this jQuery datepicker code that initially set the minDate of the datepicker.
I have a problem with this is code: Set oXmlHTTP = CreateObject(Microsoft.XMLHTTP) oXmlHTTP.Open POST,
so I have this code for tabs in jquery, the href is set to
I have code like this: public bool Set(IEnumerable<WhiteForest.Common.Entities.Projections.RequestProjection> requests) { var documentSession = _documentStore.OpenSession();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.