Hi All, firstly apologize my poor English.
My app is designed to download the new index online everytime it is opened.
However, even i updated the index content of index.json online, its content in corona are still not updated.
e.g. _G.index[3] below supposed to be “Geography” if it downloaded the new index.json, but it is still got "CHGeography"which is the 3rd value of index.json before.
I suspect the old index.json remains there, so Corona SDK is actually did not really downloaded the new one.
Any idea how to delete the caches?
local function networkListener( event ) --local function uploadListener( event ) if ( event.isError ) then print( "Network Error." ) else if ( event.phase == "began" ) then print( "Upload started" ) elseif ( event.phase == "progress" ) then print( "Uploading... bytes transferred ", event.bytesTransferred ) elseif ( event.phase == "ended" ) then print( "Upload ended..." ) print( "Status:", event.status ) print( "Response:", event.response ) \_G.index = loadsave.loadTable("index.json", system.DocumentsDirectory) print("here") print(\_G.index[3]) end end end local headers = {} headers["Content-Type"] = "application/json" local params = {} params.headers = headers --[[params.body = { filename = "temp.json", baseDirectory = system.DocumentsDirectory }]] local function downloadjson () network.download( "http://mcno.orgfree.com/uploads/index.json", "GET", networkListener, params, "index.json", system.DocumentsDirectory ) end os.remove( system.pathForFile( "index.json", system.DocumentsDirectory ) ) local lfs = require( "lfs" ) -- Get raw path to the app documents directory local doc\_path = system.pathForFile( "", system.DocumentsDirectory ) for file in lfs.dir( doc\_path ) do -- "file" is the current file or directory name print( "Found file: " .. file ) end downloadjson()
