I am creating a game that requires to get .json file from our server for updates. it works fine with the simulator but i got problem in the device when we finished to build it and test it on the device. i think it did not read or open the .json file because it did not proceed to the next method.
we test it to build in our old version of corona and it is a trial version. we try to run our game and it works fine on it.
my question now is that, why in our premium version of corona sdk got this kind of problem? and how can i solve this problem?
do anyone can help me about my case?
thanks in advance …
this is my code look like :
[code]
local jsonFile = function(file)
local path = system.pathForFile( file,system.TemporaryDirectory)
local file = io.open( path, “r” )
if file then
contents = file:read( “*a” )
io.close( file )
end
return contents
end
local jsonUrl = “http://sample.com/api/getjsonfile/”
local path = system.pathForFile( jsondata, system.TemporaryDirectory )
local myFile = io.open( path, “w+b” )
– Request remote file and save data to local file
http.request{
url = jsonUrl,
sink = ltn12.sink.file(myFile)
}
local location = jsonFile( jsondata )
local t = json.decode(location)
…
[/code] [import]uid: 142834 topic_id: 27229 reply_id: 327229[/import]