storing images (camera/gallery) in lua module for global access - works in simulator, not on device

Wow, never thought this could be that frustrating. I switched to an overlay scene, where a function saveImage() calls a parent function:

-- listener function called when user is happy with image function saveImage(event) -- capture image part finalImage = display.captureBounds( imageBounds, false ) -- save finalImage in parent scene parent:setImg1(finalImage) -- go back to addfaver composer.hideOverlay() end

parent:setImg1:

function scene:setImg1(pic) globalImg1 = pic self.view:insert(globalImg1) globalImg1.x = display.contentCenterX globalImg1.y = display.contentCenterY - 2 - imageSize/2 globalImg1:scale(imageSize/globalImg1.contentWidth, imageSize/globalImg1.contentWidth) end

Again, the same problem: I can set the two images in my parent scene via the overlay scene perfectly on the simulator, but as soon as I try it on my device, the first image is lost once I set the second image. Jesus christ, this feels again like why I gave up a couple of months ago…

/edit: Another maybe interesting observation: The first image gets losts once I start the camera or gallery for the second picture. So, even before I call the saveImage() function in the overlay for the second image, I can see that the parent scene already lost the first image. So, it may have something to do with media.capturePhoto or media.selectPhoto, but I dont see whey they could kill an image that is displayed in a parent scene. Weird, just weird (at least to me) :frowning:

Just save the picture to disk in your overlay and then load it as a new image and it should work and not get wiped out

Jep, working on that one now. Guess it’s time to stop struggling with any other solution. Thanks Sphere Game Studio for your support.

In case anyone else has a clue what exactly causes the wiping or which role the media.capturePhoto and media.selectPhoto play, I’d be more than happy to learn.