display.captureScreen problem

When I tried to make it works in device I get this error:

MyApp(422) deny file-write-data /private/var/mobile/Media/PhotoData
I search throught web and I found it:

“I got this message when trying to access the ALAssetsLibrary in another thread than the apps’ main thread. In my case I wasn’t even able to load the assets (photo albums). Putting the calls to ALAssetsLibrary into the main thread solved this issue.”
Someone can tells me but do I put this ALAssetsLibrary ??
[import]uid: 23063 topic_id: 18534 reply_id: 318534[/import]

If you are developing for Android, then you need to give your app permission to write to external storage. Please see the “Remarks” section on the API page below for more details…

http://developer.anscamobile.com/reference/index/displaycapturescreen
[import]uid: 32256 topic_id: 18534 reply_id: 71099[/import]

I’m not developing to Android

I tried to do this in iPad 2 [import]uid: 23063 topic_id: 18534 reply_id: 71114[/import]

Try running sample app “Storage/ScreenCaptureToFile” on your iPad 2. This sample app is included with the Corona SDK. This uses the display.save() API. If that works okay for you, then try changing display.save() to display.captureScreen(true) and work your way up from there. [import]uid: 32256 topic_id: 18534 reply_id: 71118[/import]

but display.save() can’t save to album right? [import]uid: 23063 topic_id: 18534 reply_id: 71129[/import]

Correct. display.save() cannot save to the photo album. What I want you to do is replace that 1 line with display.captureScreen(true). If it works in the sample project, then that would suggest that something else is wrong. [import]uid: 32256 topic_id: 18534 reply_id: 71159[/import]

works… but in my app it dosen’t work :S

local enviarCartaFunc = function()  
 texto.text = emailField.text  
 texto.font = emailField.font  
 texto.alpha = 1  
  
 local SS = display.captureScreen( true )  
  
 local baseDir = system.DocumentsDirectory  
 display.save( grupoFoto, "myFile.jpg", baseDir)  
 local uploadImagem = function()  
 native.setActivityIndicator( true )  
 SS.alpha = 0  
 texto.alpha = 0  
  
 local function uploadBinary ( filename, url, onComplete )  
 local mime = require "mime"  
 local path = system.pathForFile( filename, system.DocumentsDirectory )  
 local fileHandle = io.open( path, "rb" )   
 if fileHandle then   
 local params = {  
 body = "image\_file=" .. mime.b64( fileHandle:read( "\*a" )) .. "&image\_filename="..filename .. "&email=" .. \_G.login  
 }  
 io.close( fileHandle )  
   
 local function networkListener( event )  
 if ( event.isError ) then  
 print( "Network error!")  
 else  
 native.setActivityIndicator( false )  
 print ( "RESPONSE ETAPA2: " .. event.response )  
 end  
 end  
  
 network.request( url, "POST", networkListener, params)  
 end  
 end  
   
 local function networkListener( event )  
 if ( event.isError ) then  
 print( "Network error!")  
 else  
 print ( "RESPONSE ETAPA1: " .. event.response )  
 end  
 end  
   
 uploadBinary ( "myFile.jpg", "http://www.cartinhaparaonoel.com.br/mobile/cartas/enviarcarta.php", networkListener)  
  
  
 end  
  
 timer.performWithDelay( 100, uploadImagem, 1 )  
  
 end  

I get this error “MyApp(422) deny file-write-data /private/var/mobile/Media/PhotoData” but only in simulator, so my problem isn’t in php script

any idea?
[import]uid: 23063 topic_id: 18534 reply_id: 71193[/import]

nothing yet? [import]uid: 23063 topic_id: 18534 reply_id: 71317[/import]

It sound like your app does not have permission to write to file, but I’m not sure why that would be the case. I can’t reproduce this issue. Can you provide a small sample project that can reproduce this issue please? You can do so by clicking the “Report a Bug” link at the top of this web page. You should also indicate what version of the Corona SDK and version of the operating system that you are running. Thanks! [import]uid: 32256 topic_id: 18534 reply_id: 71461[/import]