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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:25:29+00:00 2026-06-16T00:25:29+00:00

An app I’m building needs to periodically check a known location for an updated

  • 0

An app I’m building needs to periodically check a known location for an updated file. It happens to be a PDF. If x amount of time has passed, the app needs to upload a new copy of the file. The following code snippet works. It downloads the file. But the app displays a cached version of the PDF instead of the new one. I confirmed this by looking in the app bundle. After this code runs, there is definitely a new file in the Documents directory. But in the bundle’s tmp/DiskImageCache-[random gibberish string] there is a copy of the old version of the PDF – and that is what is being displayed by my UIWebView.

I searched the NSFileManager docs and of course, schmoogled up a storm, but I have not been able to find a way to get the app to show the new upload instead of the cached version of the PDF.

Thanks a ton for any assistance you can render with this problem.

   -(void) checkFile:(NSString *)url andSaveTo:(NSString __autoreleasing *)filename {

    NSFileManager *manager = [NSFileManager defaultManager];
    NSError *error = nil;      
    NSDictionary *attributes = nil;

    if ([manager fileExistsAtPath:filename]) {

       attributes = [manager attributesOfItemAtPath:filename error:nil];

        double updateInterval = [[attributes fileCreationDate] timeIntervalSinceNow];
        cacheInterval = CacheInterval;

        if (ABS(updateInterval) > CacheInterval) {
         [self downloadFile:url andSaveTo:fileName];
        }
    }
}
  • 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-16T00:25:29+00:00Added an answer on June 16, 2026 at 12:25 am

    you can always thwart caching by appending a random number to your url as a parameter

    ex: address/yourfilehere.pdf?rand=0323094230948203984
    and give your long random parameter a new randomly generated number each time

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

Sidebar

Related Questions

App A has this BroadcastReceiver in its manifest (within <application>): And this receiver: public
My app shows newsfeed from social network. Every feed has different attachments - images,
App has fragment activity with framelayout container matching parent. User interacts with fragments ui
My app has the following models: user and watch_list. User has attributes id, name
App Store We have been developing an app for quite some time now for
My app reads an (html) file from my website, and I would like to
We're building an app, our first using Rails 3, and we're having to build
My app makes several calls to getFromLocationName from the android.location.Geocoder; class, this is currently
The app I'm developing needs to be able to pull from several different data
My app needs to keep an index of files in which the files are

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.