Hi guys
I am making an apps which will download some photo from the server, then play with the photo
I found that if i run the apps in the simulator, it find not problems not problems.
but when i put it into iphone/Ipad, it will crash and shut down the apps automatically before showing the photo.
first step, I try to use the photo from my computer, instead of download from server. then it works on both IPAD IPHONE.
So, i conclude that there are some wrong in the download process.
Can anyone tell me how to download a photo then store with a specific name i give?
here is my download function.[lua]function networkListener( event )
if ( event.isError ) then
print( “Network error - download failed” )
elseif ( event.phase == “began” ) then
print( “Progress Phase: began” )
elseif ( event.phase == “ended” ) then
print( “displaying response image file” )
myImage = display.newImage( event.response.filename, event.response.baseDirectory, 1, 1 )
myImage.alpha = 1
–myImage.Isvisble=flase
myImage.x =-20
myImage.y =-20
myImage.height= 20
myImage.width= 20
transition.to( myImage, { alpha = 1 } )
end
end
function download()
local params = {}
params.progress = true
network.download(
“http://54.254.181.71/image/”…math.random(1,5)…".png",
“GET”,
networkListener,
params,
“helloCopy.png”,
system.DocumentsDirectory
)
end
[/lua]
I am new to Lua
In my code above, I can only use the photo when I declare some variable for
A=myImage
also, the download photo will show on the screen, so i just be a silly guys to move it out of the screen.
I really want to know how to download a photo without show on the screen and I can use it for my apps?