Disable Corona Simulator Cache

The only way the Simulator is “caching” a particular state (page) in your book is if Kwik is saving a file (locally) that tells the project to open up to a certain page on reload. Kwik would be doing this… it’s not built into the Simulator, which refreshes as if from a cold start every time your reload the project.

You can explore if it’s creating some file by going to the project sandbox and checking the files within:

File > Show Project Sandbox

This will open up a window with two folders: Documents and tmp. Those represent the “device file directories”, except in this case for the Simulator.

You can just kill that entire folder (delete) it and then re-run to see what happens.

This does not work.

Is your project on a network drive or on a DropBox or similar drive?   I’ve found that when I’m running a project out of one of these non-local drives, Corona SDK can’t see the file changes and it doesn’t know to reload.    I suspect that for local drives, there is probably a “has been updated” flag that gets set that Corona can watch for that may not get set on network drives.

@zentemple. The easiest way to determine if this is a kwik issue or coronas is to run the Hello world sample code we provide.

Run it, and then with it still open modify the code so the text it displays reads “New world”.

If the simulator reloads itself (or you cmd+r) and shows “New World” instead of “Hello world” then the issue is obviously with kwik (which i am pretty sure is the issue)

Please try this and report back

(The files are in a regular folder on my Mac, by the way. AND the page WILL update in the Simulator so no need for the Hello World test. But that’s not the problem…)

I really appreciate the help offered. I think I am not getting across what the problem is clearly so I will reiterate more simply with an example…

Example: I open, in Phototshop/Kwik, any page to preview it, let’s say page 1. I make my changes to page 1 and, still in Kwik, click the Publish button as always. Here is what happens next: Kwik publishes and when done pops ups its usual “Your Project is Published” alert box. Click OK. This triggers and opens the Corona Simulator program but DOES NOT OPEN the Simulator screen itself (and sometimes, not always, I get an error, but not always; see attached).

Next, I have to Open the main.lua file for the project. This is where the ongoing problem occurs: page 1 does NOT preview. Rather, whatever other page I recently previewed shows up.

To recap, I preview page 1 however a different page, that was previously previewed, shows up in the Simulator.

Now, I find that, since there is navigation on the page, I can navigate to page 1 and, lo and behold, there are my changes. And, since the Simulator is now on page 1 because I navigated to it, I can successfully preview any more changes that I make from that point on. Simulator, from this point on, stays on page 1 where I wanted it to be in the first place.

At this point, if I decide to preview a different page than page 1, now the Simulator will only show page 1, not the current page I am working on, and I will have to go through the same thing again.

I hope this is clear.

You really probably need to talk to the folks at Kwik about this.  It sounds to me like there is some file being written out that is holding the current page and when we restart main.lua the kwik code is navigating to the last viewed page for you.

Now for the start up issues, can you have kwik **NOT** start up Corona?  Instead you start Corona and have it pointing to your project folder.  Let kwik just write the update.  Corona since it’s still running should auto reload itself.

If not, from the simulator start screen if you click CMD+R it will reload the last opened project for you so you don’t have to navigate to open the project by hand.

No, I can not NOT have Kwik open Corona.

CMD+R doesn’t work. That was the first thing I tried.

In the Simulator, I open the main.lua file directly and it loads only whatever last page was previewed successfully.

The previewing problem above has not been solved after a few weeks. Kwik does not believe it is them.

I can not finish my project because I can not preview my project.

I can not be the only one with this problem, am I?

Hi @zentemple,

I’m not familiar with Kwik’s methods, but when you “publish” one page of your book, does it generate a project folder or something? Like a folder that contains a main.lua file, all the images for that page, and perhaps a specific Lua file for the page?

Kwik is a Photoshop plugin that generates all the code into a build folder, including the main.lua.

Yes, I know the basic premise of it. :slight_smile: Just curious, when you “export”, where is it sending these files? To the same folder? Overwriting all of the previous? Or does it create a new folder?

It overwrites. Everything goes into the original folder and the code, the individual “pages” or lua files get updated including the main.lua.

When I first started using Corona Simulator for previewing, Corona would show whichever page I was previewing. Then, one day, it stopped doing that. What changed? I could never figure that out. Nothing, as I recall.

Hi again,

OK, so just to confirm (and it’s been a couple weeks since we went through this):

  1. You export Page 1 (for example) of your book. It writes to whatever folder, say “myBook”

  2. Several minutes later (or whatever), you export Page 4 of your book to the same “myBook” folder, and you confirm that everything was overwritten (the time stamps on those files reflect the time you exported it).

  3. You open up the Simulator and it shows Page 1 again? Not Page 4?

  4. There are no errors reported in the Terminal/console?

Best regards,

Brent

  1. yes, exports to the build folder

  2. yes, timestamps correct

  3. yes, shows whichever page I had managed to navigate to last, not the one exported

  4. no errors. This is what it says, several times: "2013-11-16 06:57:57.069 Corona Simulator[50835:707] The file sandbox for this project is located at the following folder:

    (/Users/robertlewis/Library/Application Support/Corona Simulator/build-6D782599E164D5678E1812FBFB14CDE5)

2013-11-16 06:57:57.082 Corona Simulator[50835:707] -----------------------------------------------

2013-11-16 06:57:57.082 Corona Simulator[50835:707] WARNING: Simulator does not support multitouch events

2013-11-16 06:57:57.084 Corona Simulator[50835:707] WARNING: Simulator does not support multitouch events"

How do I disable caching in the Simulator? I have to constantly quit the Simulator to get it to show a current preview. And now that doesn’t work either!

Hi @zentemple,

I’m not sure if this will help, but in the Simulator preferences (Corona Simulator > Preferences), there is the option to always refresh the project when you save it. If this is not the behavior you want, you can set it to “Never” and then use Command-R to refresh the Simulator… this is the method I use, and it works fine.

You shouldn’t need to quit the Simulator each time.

Best regards,

Brent

It isn’t “always refresh” the project. It’s “relaunch”.  In any case, it is not refreshing, even when I quit. I’m going to remove the program and re-install it to see if that helps.

I have downloaded and installed a new version of Corona Simulator. Corona Simulator is showing a page from earlier today, not the page I just previewed.

Just to be sure it wasn’t the Mac, I restarted the computer, restarted all programs.

The Corona Simulator is not previewing anything but the same old page.

Hi @zentemple,

I’m not sure what you mean by “page”. I recall that you’re designing an e-book using Kwik, so I assume it’s jumping to the first page in the book or something like that?

Refreshing the Simulator is like starting the app from a cold start… as if a user just opened the app fresh, and it was not residing in the device memory (with the Simulator being the “device” in this case). So, you will always start at the first page, unless you code an option (or Kwik does so) to automatically go to a certain page.

It’s also possible that you have more than one project going, like various versions of the app that were exported by Kwik. Make sure you’re opening the *newest* version (you might need to navigate to it). The Simulator, by default, will open up the last project opened, assuming you have “Automatically open last project” checked in the Preferences.

Hope this helps,

Brent

It is an ebook with “pages”. Here is an example of what happens. I open the project. I go to the first page and I publish just that page, page 1, in order to preview it in the Simulator. I click the export images, export this page only, click the publish button. It does it’s thing, opens the Simulator program…but not the Simulator window. At that point I have to pull down under File in the Simulator and choose Open to open the main.lua file for this project. Now the Simulator window opens with a different page, not page 1 but page 4.

What I see in the simulator is the wrong page, not the one I previewed. Worse than that, it is showing a page that had some issues with it, missing images and navigation. This means that I can not even navigate off of this wrong page to see if my page 1 updated properly. The Simulator has completely failed.

I’ve never had this problem in the past year, just in the past few days. Nothing else has changed to cause this as far as I can tell.