Code is below. When quitting and restarting the app in the simulator, the score data is retreived. On the iPad, it is not. Is there some kind of build setting I need to set for this to work on real devices?
[code]
if( event.type == “applicationExit” ) then
–create a file to save current state
local path = system.pathForFile( “scores.txt”, system.DocumentsDirectory );
local file = io.open( path, “w+b” );
local scores = “1,2,3”;
file:write( scores );
io.close( file );
elseif ( event.type == “applicationStart” ) then
–check for saved data
local path = system.pathForFile( “scores.txt”, system.DocumentsDirectory );
local file = io.open( path, “r” );
if file then
print(“loading previous state variables…”);
local contents = file:read( “*a” );
io.close( file );
else
print(“did not find file.”);
end
elseif ( event.type == “applicationSuspend” ) then
elseif ( event.type == “applicationResume” ) then
end
end
[/code] [import]uid: 52127 topic_id: 12169 reply_id: 312169[/import]