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 7942843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:05:40+00:00 2026-06-04T00:05:40+00:00

I am currently a newbie to iOS development and trying to get the cache

  • 0

I am currently a newbie to iOS development and trying to get the cache policy (NSURLRequestReturnCacheDataDontLoad) to pull from the cache to view a web page while being in offline on the iPhone (using airplane mode). I am currently using the Reachability API provided by Apple to figure out if the network/wifi connection is up and running or not. This works fine but when I go to airplane mode I am not getting a webpage to populate the UIWebView. Any suggestions would very helpful, I look around online but did not find much helpful links. Thanks.

The code is below:

*- (IBAction)refresh:(id)sender 
{
    NSURL *url = [NSURL URLWithString:_entry.articleUrl]; 
    NSURLRequest *webRequest = nil;

    NSString *articleUrl = [_entry.articleUrl substringFromIndex:7];

    NSArray *myArray = [articleUrl componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];

    NSString *hostUrl = [myArray objectAtIndex:0];

    NSLog(@"%@", hostUrl);
    Reachability *reachability = [Reachability reachabilityWithHostName:hostUrl];

    NetworkStatus netStatus = [reachability currentReachabilityStatus];

    [[NSURLCache sharedURLCache] setMemoryCapacity:1024*1024*10];

    // Verify current help file cache if we have network connection...
    if (netStatus == ReachableViaWWAN || netStatus == ReachableViaWiFi) 
    {
        webRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30];   
    } 
    else 
    {
        // Network NOT reachable - show (local) cache if it exists
        webRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReturnCacheDataDontLoad timeoutInterval:30];
    }

    [_webView loadRequest:webRequest];
}*
  • 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-04T00:05:42+00:00Added an answer on June 4, 2026 at 12:05 am

    Unfortunately, UIWebView does not persist web page cache. I have never done this but using AFCache should work for cache persisting.

    Also make sure you got the cached page in place. If the webpage is not cacheable (i.e. with Pragma: no-cache), UIWebView might still not cache it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm newbie on iOS development and I'm currently testing RestKit 0.9.3 for iOS with
I am an iOS development newbie. I want to go to another page (CountryViewController)
ES 2.0 newbie here. I'm currently trying to make some 3D interlaced images from
I have moved from rails 3.0 to rails 2.3.4.So a newbie currently for this
PHP newbie here. I'm currently developing a shopping cart web site using PHP and
I'm a Objective-C newbie and I'm currently trying to build an app which has
I'm a MOSS 2007 newbie and am trying to find out where a view
I am newbie to android development and currently I am studying the 3D animation
I'm a newbie to Rails and programming in general (currently learning from a book
I am a newbie in Spring based web development. Our site is Spring based

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.