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

  • Home
  • SEARCH
  • 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 8203965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:44:31+00:00 2026-06-07T07:44:31+00:00

I have two local .html files in the Resources folder. I’m trying to load

  • 0

I have two local .html files in the Resources folder. I’m trying to load them the following way, but only the final page loads. What am I doing wrong?

File = please_wait.html

This one does not work.

NSError *error;
NSString* path = [[NSBundle mainBundle] pathForResource:@"please_wait" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
[webView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:path]];   

 //Big "do-while" loop here.  It works fine so I omitted it.

File = update_graph.html

This one does not work

 path = [[NSBundle mainBundle] pathForResource:@"update_graph" ofType:@"html"];
 htmlString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
 [webView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:path]];

//Lots of code removed.  All works correctly and doesn't touch webview

This last one works perfectly. Google displays.

string = @"http://google.com";  
NSURL *url = [NSURL URLWithString: string];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
  • 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-07T07:44:33+00:00Added an answer on June 7, 2026 at 7:44 am

    It appears from your comment that your UIWebView loads just fine, but it does not get a chance to refresh itself on the screen until you exit your method. It is not enough to set a break point inside the method and wait for the view to load: you must exit the method before iOS realizes that it needs to call UIWebView‘s drawRect method.

    To fix this, split your method in three parts, A B and C, and set UIWebView‘s delegate in A to invoke B on webViewDidFinishLoad:, and the delegate in B to call C.

    Here is how to implement this: start with a delegate that can call a selector when the loading has completed:

    @interface GoToNext : NSObject <UIWebViewDelegate> {
        id __weak target;
        SEL next;
    }
    -(id)initWithTarget:(id)target andNext:(SEL)next;
    -(void)webViewDidFinishLoad:(UIWebView *)webView;
    @end
    
    @implementation GoNext
    -(id)initWithTarget:(id)_target andNext:(SEL)_next {
        self = [super init];
        if (self) {
            target = _target;
            next = _next;
        }
        return self;
    }
    -(void)webViewDidFinishLoad:(UIWebView *)webView {
        #pragma clang diagnostic push
        #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
        [target performSelector:next];
        #pragma clang diagnostic pop
    }
    @end
    

    Now split your method into three parts – loading the first page, loading the second page, and loading the third page:

    -(void)loadPleaseWait {
        NSError *error;
        NSString* path = [[NSBundle mainBundle] pathForResource:@"please_wait" ofType:@"html"];
        NSString* htmlString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
        webView.delegate = [[GoToNext alloc] initWithTarget:self andNext:@selector(loadUpdateGraph)];
        [webView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:path]];
        // big do-while loop
    }
    
    -(void)loadUpdateGraph {
        NSError *error;
        NSString* path = [[NSBundle mainBundle] pathForResource:@"update_graph" ofType:@"html"];
        NSString* htmlString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
        webView.delegate = [[GoToNext alloc] initWithTarget:self andNext:@selector(loadGoogle)];
        [webView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:path]];
        // Lots of code removed
    }
    
    -(void)loadGoogle {
        string = @"http://google.com";  
        NSURL *url = [NSURL URLWithString: string];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
        [webView loadRequest:requestObj];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have the following two branches and the local branch is 'mybranch'
I have a local branch work, where I created two new files a.py, b.py
I currently have two files, register.html and register.jsp. The HTML file asks the user
in /usr/local i now have two mysql folders: mysql-5.1.34-osx10.5-x86 mysql-5.1.37-osx10.5-x86_64 is it possible to
I have two git repositories: report.git (Master on remote location) cloned.git (Local) I lost
Suppose you have two linked servers called Local and Remote respectively. Is there a
struts 2.0.11 - Currently I'm in my local machine and have two different web
Have two folders with approx. 150 java property files. In a shell script, how
http://www.keironlowe.host56.com/Website%20Testing/index.html At the bottom below the paragraph of text I have two images with
I have two Flash files: pre-loader and application. Pre-loader: (D:\Projects\FlashApps\dd\edd.fla) is doing basically this:

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.