I'm trying to remove a file if user exit aplication or suspend her
but only works in simulator... in my iphone it did'nt work...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function onSystemEvent( event ) if "applicationSuspend" == event.type or "applicationExit" == event.type then local destDir = system.DocumentsDirectory -- where the file is stored local results, reason = os.remove( system.pathForFile( "noticias.xml", destDir ) ) if results then print( "file removed" ) else print( "file does not exist", reason ) end end end Runtime:addEventListener( "system", onSystemEvent ) |