Problem with getting screenshot using latest ArcGIS SDK on iOS 6

702
4
07-31-2013 07:15 AM
OguzhanTopsakal
New Contributor III
This question has been asked before and answered (for example: http://forums.arcgis.com/threads/78166-How-to-save-screenshot-of-AGSMapView). However, the solution provided returns a black blank image on iOS 6 when used on a device (it works on the simulator). The suggestion to fix the problem on the device is to try use the following code:

    CAEAGLLayer *eaglLayer = (CAEAGLLayer *) self.mapView.layer;
     eaglLayer.drawableProperties = @{
     kEAGLDrawablePropertyRetainedBacking: [NSNumber numberWithBool:YES],
     kEAGLDrawablePropertyColorFormat: kEAGLColorFormatRGBA8
     };


However, it did not work for me. I would really appreciate if someone can share a solution for this problem..

Note: Latest ArcGIS SDK, I am using is:Version 10.1.1 Update 1

Thanks!
0 Kudos
4 Replies
RickJones
Occasional Contributor II
I use the getImage method from bernese.
I use it in this manner:


 //export image of mapView

       UIImage *screenshot = [[UIImage alloc] initWithData:[self getImage]];

 //save image to photo album
 UIImageWriteToSavedPhotosAlbum(screenshot,self,@selector(image:didFinishSavingWithError:contextInfo:),nil);


Edit: I do not have any code similar to the DrawableProperty snippet you included.
0 Kudos
OguzhanTopsakal
New Contributor III
I use the getImage method from bernese.
I use it in this manner:


 //export image of mapView

       UIImage *screenshot = [[UIImage alloc] initWithData:[self getImage]];

 //save image to photo album
 UIImageWriteToSavedPhotosAlbum(screenshot,self,@selector(image:didFinishSavingWithError:contextInfo:),nil);


Edit: I do not have any code similar to the DrawableProperty snippet you included.



Thank you very much for your reply. I noticed that the code starts working if you send the app to the background and bring it back. It is weird but it starts working correctly after sending the app to the background and getting it back to the foreground but it does not work before doing it, it just shows blank image..
0 Kudos
baidynathpanda
New Contributor
If you are developing a enterprise application better use the UIGetScreenImage() API. (Don't use if you are developing a app for publishing to appstore)

I was facing the same issue but what I did was:
1)Captured the complete screen shot using this API
2)Cropped the image only to the MAP area.(If you have both Orientation support then add conditions for all four)

Its working perfect for me.
0 Kudos
OguzhanTopsakal
New Contributor III
Excellent! Thank you very much. UIGetScreenImage() worked for me too.
0 Kudos