Simulator Doesn't Download New Files From Server

I’m having a problem with the Simulator and downloading files from my server.
On launch, my games download a couple of files from my server- daily puzzles, ad information, etc. It seems like once the simulator has downloaded a file from the server, it caches it somewhere and doesn’t download fresh copies.
For example:

  • I launch one of my games in the simulator and it downloads the daily puzzle.
  • I make a change to the daily puzzle and upload a new file to my server.
  • I delete the puzzle file from the app’s sandbox folder on my hard drive.
  • I relaunch the app in the simulator and the original puzzle file is back in the tmp directory- not the new file. Where it came from, I don’t know!
  • If I launch the app on device, it will show the new file, so I know the file on the server has been updated.
  • If I launch the app on an Android device, clear the cache, upload a changed puzzle file and then relaunch the app, the new puzzle file shows up no problem. This issue is limited to the simulator.

Does anybody have any insight into this? It’s making me feel like a crazy person. I’ve tried quitting the simulator, but it doesn’t help. I haven’t tried restarting my Mac, but that’s a terrible solution, so I hope it doesn’t come to that.

This is just a hunch, but could it be that your server is the culprit and it is delivering a cached response?

I’ve never experienced issues like that myself. One way how you could rule it out being the server is by running an instance of XAMPP on your computer and have your server files there instead. If it’s a simulator issue, then the issue should occur with XAMPP as well. If it doesn’t occur after that, then it’s likely that your server is serving a cached response to your simulator/computer.

You can already try running Windows search for your file and see if it appears in any folders where it shouldn’t.

Thanks- I’ll give it a try. :smiley:

I often find that just adding a cachebuster to the end of the url is enough to avoid this problem:

Instead of:
local url = "https://yourwebsite.com"

Try this:
local url = "https://yourwebsite.com?cb="..os.time()

This makes the request unique, so the server returns a non-cached response. Of course there might be times when you don’t want this to happen, where a cached response would be fine.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.