remove file not working

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…

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 )   
  

if I lock my iphone or simples press the menu button, the file still there
but in simulator, the file are deleted… anyone can help me? [import]uid: 23063 topic_id: 16469 reply_id: 316469[/import]

hey can you chk same code with button click event
:slight_smile: [import]uid: 12482 topic_id: 16469 reply_id: 61540[/import]

don’t matter… the file still deleting… but for some reason, my app still catch this xml from another way if I don’t have network connection
its like my XML are stored in a save place that I can’t see

you see… when I close my app, I get the “print( “file removed” )”
it means that the XML was deleted, and when I open my app I get the “print( “xml downloaded” )”

BUT the biggest question is…

If i’m connected to internet for the first time that I open my app
works fine, but if I close my app and block the connection with internet and try to open my app, I get the same menssage “print( “xml downloaded” )”… my app still downloading my XML without connection with the internet?? oO
I don’t know what to think about it…

here are my code that I use to pull XML from internet and delete:
http://developer.anscamobile.com/forum/2011/10/16/networkrequest-problem

please someone help mee =(( [import]uid: 23063 topic_id: 16469 reply_id: 61576[/import]