Is anyone experiencing issues with network.download when using a daily build?
Seeing some weird stuff here…
[UPDATE] Bug filed: Case # 13184. [import]uid: 13784 topic_id: 23929 reply_id: 323929[/import]
Is anyone experiencing issues with network.download when using a daily build?
Seeing some weird stuff here…
[UPDATE] Bug filed: Case # 13184. [import]uid: 13784 topic_id: 23929 reply_id: 323929[/import]
FTR, I’m trying to pull raw text data.
A test URL is http://inzi.com/rawdata.txt [import]uid: 13784 topic_id: 23929 reply_id: 96404[/import]
Ok, tested on IOS device and it’s ok. Tested on simulator works.
But this code, when built, fails on android 2.2, 2.3, 4.0. Four devices tested.
Output from Request and Download should be the same.
Instead, it seems it might be encoded. Either way, it’s not working as it should?
Filing bug:
Here is test code for you if you want to verify.
[code]
display.setStatusBar(display.HiddenStatusBar)
local doDownload
local TextDisplay = display.newText(“Log:”,3,3,display.contentWidth-5, display.contentHeight-5, native.systemFont,display.contentWidth/20)
TextDisplay:setReferencePoint(display.TopLeftReferencePoint)
TextDisplay.text = TextDisplay.text … “\n” … “here”
local function doRequest()
local function requestDatanetworkListener(event)
if ( event.isError ) then
print( “Network error!”)
TextDisplay.text = TextDisplay.text … “\n” … “Network error!”
else
print ( "RESPONSE: " … event.response )
TextDisplay.text = TextDisplay.text … “\n” … "RESPONSE: " … event.response
print (“Testing download now”)
TextDisplay.text = TextDisplay.text … “\n” … “Testing download now”
doDownload()
end
end
print (“Response Test first”)
TextDisplay.text = TextDisplay.text … “\n” …“Response Test first”
local rRandom = math.random()
local sDataURL = "http://inzi.com/rawdata.txt?"..rRandom
network.request( sDataURL, “GET”, requestDatanetworkListener)
end
doRequest()
function doDownload()
TextDisplay.text = TextDisplay.text … “\n\n” … “Download Test”
local rRandom = math.random()
local sDataURL = "http://inzi.com/rawdata.txt?"..rRandom
local function testDownload(event)
if ( event.isError ) then
print ( “Network error!”)
TextDisplay.text = TextDisplay.text … “\n” … “Network error!”
else
print ( "RESPONSE: " … event.response)
TextDisplay.text = TextDisplay.text … “\n” … "RESPONSE: " … event.response
local dataFileLoc = system.pathForFile( “ofileTest.txt”, system.DocumentsDirectory )
local dataFile = io.open( dataFileLoc, “r” )
local fileDataStr = dataFile:read( “*a”)
print (“fileDataStr”)
TextDisplay.text = TextDisplay.text … “\n” … “fileDataStr”
print (fileDataStr)
TextDisplay.text = TextDisplay.text … “\n” … fileDataStr
end
end
network.download( sDataURL, “GET”, testDownload,“ofileTest.txt”, system.DocumentsDirectory )
end
[/code] [import]uid: 13784 topic_id: 23929 reply_id: 96425[/import]