network.download() downlading from cache.db

i have a problem with network download, it doesn’t always download files from my server. it seams to get stuck on some files and downloads them form the cache.db(i think).

when i have this problem the only way to fix it is by deleting the cache.db file on the iphone or mac simulator. restarting the phone or the simulator doesn’t fix this problem.

doesn’t happen on the windows simulator only on the mac and iphone.

  1. delete images in the documents folder.
  2. edit images in Photoshop.
  3. download images from web-server to documents folder.
  4. check that all newly edited images were downloaded, checked with code and manually.
  5. works 95% of the time.
  6. sometimes downloads come from a mysteries place (caches.db) old images, not newly edited images, sometimes its one file, sometimes its all the files.
  7. the only way to get it working again is to manually delete the caches.db from the iphone or mac simulator.
  8. works again for another 95% of the time then gets stuck.

has anybody else had similar problems?

[import]uid: 89663 topic_id: 32575 reply_id: 332575[/import]

Caching is for the most part good for you. But it does present problems.

The easiest solution is to add a string to the end of the URL to make the URL unique:

url = “http://mysite.com/images/pic.png?a=” … os.time()

It will trick the system since it thinks it’s a new URL and the server will ignore the query string added on. If your URL already uses query strings, then just tack an “&a=” … os.time() on to the end. If you’re query string is already passing a variable called a, just make up something not in use.
[import]uid: 19626 topic_id: 32575 reply_id: 129671[/import]

Caching is for the most part good for you. But it does present problems.

The easiest solution is to add a string to the end of the URL to make the URL unique:

url = “http://mysite.com/images/pic.png?a=” … os.time()

It will trick the system since it thinks it’s a new URL and the server will ignore the query string added on. If your URL already uses query strings, then just tack an “&a=” … os.time() on to the end. If you’re query string is already passing a variable called a, just make up something not in use.
[import]uid: 19626 topic_id: 32575 reply_id: 129671[/import]

that’s is brilliant :slight_smile:

thank you. [import]uid: 89663 topic_id: 32575 reply_id: 129695[/import]

that’s is brilliant :slight_smile:

thank you. [import]uid: 89663 topic_id: 32575 reply_id: 129695[/import]

genius!

i was just banging my head on the wall why i’m getting different results for the same request on two devices, where obviously one was cached :slight_smile:

genius!

i was just banging my head on the wall why i’m getting different results for the same request on two devices, where obviously one was cached :slight_smile:

YES!!! I’ve been going crazy and your trick worked!!!

YES!!! I’ve been going crazy and your trick worked!!!