GBC Data Cabinet - Working in Simulator, not in app

Hi everyone, maybe I can get a helping hand here.

I’ve implemented GBC Data Cabinet on my reading app for bookmarking, and I found it very easy and convenient to use, I love it!

Nevertheless, I’m facing a strange issue which is the following:

When used within a single session, it works like a charm: I can go to the page where I want to bookmark, save, go to the home screen, push my bookmark button, and it comes back into the right place.

Nevertheless, if I close the app, reopen and I push the bookmark button, I get an error as if the bookmark was never saved (returns a nil instead of the string code for that page).

Even stranger, it works perfectly well in the Corona SDK Simulator, but it doesn’t when I install the app in my device.

Could this be related to writing permissions? Because it seems to handle it well in memory (while in-app) but not being able to commit persistently.

I would much appreciate your help with this issue. Here’s an attachment of the error:

Hi… I am the author of GBC Data Cabinet.

There are 2 types of data… session and persistent. Can you confirm that you are using using persistent data so that you can recall it later?

The error you attached indicates an error with the “find” function. There is no find() function in GBC Data Cabinet, so I would check the syntax there, as well as checking variable scope.

If you like, you can send me some code for me to look at… post it here, or send me a private message.

–john

1 Like

Hi!

Thanks for the swift reply!

I’ll review this as soon as I’m out of work today, I’ll check the session/persistent, rest of the recommendations and give it a shot.

If I’m find myself stuck again I’ll get back with you with the code sample.

Thanks for this awesome plugin!

Hey there!

Effectively, I was missing this line:

local stored =GBCDataCabinet.save(“NorilskSaveCabinet”)

I was SETTING the data, but not actually SAVING it, so it worked within the session like a charm, but when restarting the app it crashed, because there was nothing to pull up.

NEVERTHELESS, note that this behavior happened only when the app was effectively installed in the device.
Within the Simulator, it picked up the SET data as if it was SAVED, pretty interesting behavior.

So, in summary, facepalm to me, and kudos to you and Vlad.

Thank you for this awesome plugin!

Glad its working! :grinning:

Depending on when you attempt to retrieve the data, I guess it could work in the simulator. Data cabinets are added as session data until you save.

I am glad its working and you find the plugin useful!

–john

1 Like