display.loadRemoteImage on showOverlay shown on simulator but not on iphone

Hi there,

I load an overlay and in it I load a remote picture if it isn’t already downloaded and exisitng in the temporay directory.
It works fine on the simulator but when I build it and run it on my iphone it doesn’t show up on the screen.

When I close the overlay and load it a second time it says the image exists and it shows me a frame with the picture not in it.

What could be the problem of this?

Here is the code I use in the overlay scene to display the picture

function networkListener( event )
img = event.target
if ( event.isError ) then
print ( “Network error - download failed” )
else
event.target.alpha = 0
transition.to( event.target, { alpha = 1.0 } )
end
scene.view:insert(img)
print ( "RESPONSE: " … event.response )
end

local function fileExists(fileName, base)
assert(fileName, “fileName is missing”)
local base = system.TemporaryDirectory
local filePath = system.pathForFile( fileName, base )
local exists = false
–print(“filepath:” … filePath)
if (filePath) then – file may exist. won’t know until you open it
local fileHandle = io.open( filePath, “r” )
if (fileHandle) then – nil if no file found
exists = true
io.close(fileHandle)
end
end
return(exists)
end

function explode(div,str)
if (div==’’) then return false end
local pos,arr = 0,{}
– for each divider found
for st,sp in function() return string.find(str,div,pos,true) end do
– Attach chars left of current divider
table.insert(arr,string.sub(str,pos,st-1))
pos = sp + 1 – Jump past current divider
end
– Attach chars right of last divider
table.insert(arr,string.sub(str,pos))
return arr
end
function scene:enterScene( event )
local group = self.view
local params = event.params
local index = params.index
–try adapting file for app with scale factor
local file_parts = explode(".", storyboard.items[index].photo)
local file_url
file_name = “image” … storyboard.items[index].objectID
if storyboard.scaleFactor == 1 then
file_url = “http://xxx.nl” … file_parts[1] … “_bg”;
file_name = file_name … “bg”;
elseif storyboard.scaleFactor == 2 then
file_url = “http://xxx.nl” … file_parts[1] … “_bg2”;
file_name = file_name … “bg2”;
else
file_url = “http://xxx.nl” … file_parts[1];
end

file_url = file_url … “.jpg”;
file_name = file_name … “.jpg”;

–load the remote picture if not exists
if fileExists(file_name) then
print(“File bestaat”)
img = display.newImageRect(file_name, system.TemporaryDirectory, 320 , 213 )
img:setReferencePoint(display.TopLeftReferencePoint)
img.x = 0
img.y = 36

group:insert(img)
else
print(“Load Remote”)
display.loadRemoteImage( file_url, “GET”, networkListener, file_name , system.TemporaryDirectory, 0 , 36 )
end

end

Anybody has a clue why it doesn’t show up on my iphone? [import]uid: 191606 topic_id: 35609 reply_id: 335609[/import]