Saving data in iPhone app (revMobile)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Saving data in iPhone app (revMobile)
How might i go about saving data before the app quits? and then loading the data again the next time the app opens?
Re: Saving data in iPhone app (revMobile)
Hi ukaussie,
check the PDF that came with the latest alpha (6 or 7?) for the different "specialfolderpath()" codes supported on the iPhone.
Best
Klaus
check the PDF that came with the latest alpha (6 or 7?) for the different "specialfolderpath()" codes supported on the iPhone.
Best
Klaus
Re: Saving data in iPhone app (revMobile)
Hi Klaus,
I've read the PDF but it is not clear how to transform that information into actual code. I've tried setting the code to the below (for saving and retrieving, respectively), but it doesn't work.
Do i have the path correct? They recommend saving data to the 'documents' folder within the iPhone app bundle. If i have the path correct do i have the syntax incorrect?
Grant.
I've read the PDF but it is not clear how to transform that information into actual code. I've tried setting the code to the below (for saving and retrieving, respectively), but it doesn't work.
Code: Select all
put tResultsField into URL "file:/home/documents/saveddata.txt"
Code: Select all
put URL "file:/home/documents/daveddata.txt" into field "resultsField"
Grant.
Re: Saving data in iPhone app (revMobile)
Hi Grant,
use the "specialfolderpath()" function!
...
## I would recommend to create a folder for your app in that folder first.
## This way ther is no danger that a file named "saveddata.txt" already exists!
put tResultsField into URL("file:" & specialfolderpath("documents") & "/saveddata.txt")
...
Best
Klaus
use the "specialfolderpath()" function!
...
## I would recommend to create a folder for your app in that folder first.
## This way ther is no danger that a file named "saveddata.txt" already exists!
put tResultsField into URL("file:" & specialfolderpath("documents") & "/saveddata.txt")
...
Best
Klaus
Re: Saving data in iPhone app (revMobile)
Hi Klaus,
That worked! Brilliant, thanks for your help.
Cheers,
Grant.
That worked! Brilliant, thanks for your help.
Cheers,
Grant.
Re: Saving data in iPhone app (revMobile)
Hello,
I wrote these 2 functions below for my application :
And interesting link for folders : http://intkeystrokes.posterous.com/wher ... obile-runr
I hope this help, Cheers, Fabrice
I wrote these 2 functions below for my application :
And interesting link for folders : http://intkeystrokes.posterous.com/wher ... obile-runr
Code: Select all
global gConfigArray
function fSaveConfigFile
--Save Configuration File
put specialFolderPath (documents) & "/Config.txt" into lConfigFile
open file lConfigFile for write
repeat with tVarNum = 1 to 11
write gConfigArray[tVarNum] & CR to file lConfigFile
end repeat
close file lConfigFile
end fSaveConfigFile
function fReadConfigFile
--Read Configuration File
put specialFolderPath (documents) & "/Config.txt" into lConfigFile
open file lConfigFile for read
repeat with tVarNum = 1 to 11
read from file lConfigFile for 1 line
put it into gConfigArray[tVarNum]
end repeat
close file lConfigFile
end fReadConfigFile