Page 1 of 2
Upgrade App lost data
Posted: Sat May 03, 2014 5:40 pm
by sirobchGA0cda
Hello,
I save my application data IOS with a stack launcher.
I attach the code :
Code: Select all
on openstack
put specialFolderPath("Documents") & "/saving.livecode" into tMainStackPath
if there is not a file tMainStackPath then
put specialFolderPath("engine") & "/saving.livecode" into tOriginalStackPath
put url ("binfile:" & tOriginalStackPath) into url ("binfile:" & tMainStackPath)
end if
go stack tMainStackPath
end openstack
This works perfectly on iPad and in the simulator.
when I do an update of the application, it remembers the old file into the memory.
I need to deleted the app on the iPad to take the new version, but the data is not retained.
How to install an update keeping all the data.
thank you in advance for your answers
Boris
Re: Upgrade App lost data
Posted: Sat May 03, 2014 7:17 pm
by jmburnod
Salut Boris,
I understand there is a file tMainStackPath
What happen with that ?
Code: Select all
on openstack
put specialFolderPath("Documents") & "/saving.livecode" into tMainStackPath
--if there is not a file tMainStackPath then -- there is a file tMainStackPath
put specialFolderPath("engine") & "/saving.livecode" into tOriginalStackPath
put url ("binfile:" & tOriginalStackPath) into url ("binfile:" & tMainStackPath)
--end if
go stack tMainStackPath
end openstack
But you have to know if that is the first openstack of the new version otherwise it will do this at each openstack
Kind regards
Jean-Marc
Re: Upgrade App lost data
Posted: Sat May 03, 2014 8:25 pm
by sirobchGA0cda
Salut Jean-Marc,
tMainStackPath, it's for saving/loading the stack (saving.livecode) with the data.
Thanks for your code, but he don't save the data when I shutdown the application.
Best regards
Boris
Re: Upgrade App lost data
Posted: Sat May 03, 2014 8:31 pm
by jmburnod
but he don't save the data when I shutdown the application.
No.
He probably save the data but openstack set the stack of the documents folder to the stack of the engine folder
That is the reason why you have to know if that is the first openstack with the new version
You can use a file DocInstaller.txt to store infos about the installation history
Read this file at preopenstack, compare infos and do what is necessary and don't forget to
update this file to avoïd an intallation at each openstack
Re: Upgrade App lost data
Posted: Sun May 04, 2014 6:50 am
by sirobchGA0cda
Thank you for the reply,
but I do not understand how to do it the difference between a new installation and update.
If every update my application, you must uninstall the old and lose all the data, I do not think this is ideal.
I will continue looking for a solution, but for now I do not know how.
Best
Boris
Re: Upgrade App lost data
Posted: Sun May 04, 2014 9:20 am
by jmburnod
Salut Boris,
If every update my application, you must uninstall the old and lose all the data, I do not think this is ideal.
Anyway, if you replace your stack tMainStackPath, you lost your data
I never used stack to store data of an app.
I use files ".txt" in a folder of the documents folder.
Data are saved in those files and read when that is necessary.
In your case I think you can compare the content of a fld or a custom property of the document folder stack and engine folder stack.
Something like that for a customprop of the stack (no tested)
Code: Select all
on openstack
put specialFolderPath("Documents") & "/saving.livecode" into tMainStackPath
put specialFolderPath("engine") & "/saving.livecode" into tOriginalStackPath
if the uMyVersion of stack tMainStackPath <> the uMyVersion of stack tOriginalStackPath then
put url ("binfile:" & tOriginalStackPath) into url ("binfile:" & tMainStackPath)
end if
wait 200 milliseconds -- not sure that is necessary
go stack tMainStackPath
end openstack
Best
Jean-Marc
Re: Upgrade App lost data
Posted: Sun May 04, 2014 10:28 am
by sirobchGA0cda
Salut Jean-Marc,
I have tested with your code and changed the version of the custom property uMyVesion in my stack.
It's the same problem.
Best
Boris
Re: Upgrade App lost data
Posted: Sun May 04, 2014 11:03 am
by jmburnod
Salut Boris,
It's the same problem.
Yes. If you write changed data in your stack tMainStackPath and if you replace it
with your engine folder stack you lost data
Maybe exchange will be easier in french by phone

Re: Upgrade App lost data
Posted: Sun May 04, 2014 11:07 am
by sirobchGA0cda
Salut Jean-Marc,
Yes I will call you it's better.
Boris
Re: Upgrade App lost data
Posted: Sun May 04, 2014 1:22 pm
by michel_bujardet
sirobchGA0cda wrote:Hello,
I save my application data IOS with a stack launcher.
Why not use
Code: Select all
put specialFolderpath("application support")
It will retain data between versions of an app.
Re: Upgrade App lost data
Posted: Sun May 04, 2014 1:49 pm
by Klaus
michel_bujardet wrote:Why not use
Code: Select all
put specialFolderpath("application support")
?
Because this is not available on iOS?

Re: Upgrade App lost data
Posted: Sun May 04, 2014 2:41 pm
by sirobchGA0cda
Thanks for the suggestion, but it's not working.
Best
Re: Upgrade App lost data
Posted: Sun May 04, 2014 7:10 pm
by michel_bujardet
Klaus wrote:michel_bujardet wrote:Why not use
Code: Select all
put specialFolderpath("application support")
?
Because this is not available on iOS?

Sorry. I use to do that in Mac OS X and assumed too quickly it existed on iOS. Then why not use a folder in the library, as advised in the Dictionnary...
For iOS systems:
• library - The folder in which the application can store data of various types. In particular, data private to the application should be stored in a folder named with the app's bundle identifier inside library (this folder is backed up by iTunes on sync).
Re: Upgrade App lost data
Posted: Sun May 04, 2014 7:32 pm
by jacque
If I understand the problem right, the data works fine until the app is deleted.
On Android, and I think iOS too, deleting an app removes its data files. That's just how the OS works. If you are updating an app from the App Store then the data files will remain, but when you are testing locally and you delete the app, any files the app has created are removed.
Re: Upgrade App lost data
Posted: Sun May 04, 2014 10:23 pm
by jmburnod
Hi All,
I think we have solved the problem for the app of Boris in french by phone.
But this question often comes back. For IOS but also for standalone
For data I use the documents folder on OSX, windows and IOS for my app EcrireEnPictos (same stack for all)
One NecessaryForMyApp folder with folders they contains txt, png and aif files.
For update I use a txt file with the num of the installed version
I compare both version number and do what is to do at preopenstack
Sometimes it is just a new standalone and sometimes I have to upgrade
contents with new files or folders
On IOS the only problem I met with this method that is get diskspace to know if there is enough space.
Kind regards
Jean-Marc