Bug 1894 - Problem with CGImage.ScreenImage on iPad
Summary: Problem with CGImage.ScreenImage on iPad
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-11-05 07:41 UTC by Stefan Tröndle
Modified: 2013-06-02 12:58 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Stefan Tröndle 2011-11-05 07:41:43 UTC
Hi all,

we have experienced a problem, when using a iPhone targeted application on an iPad2. We take screenshots (to recognize certain elements from the camera) and use them in the application.

Everything works fine on the iPhone 3GS/4.
When we start the application on an iPad2 with the included camera, it stops working (the camera image shows, but the app does not recognize anything).

We changed our code to save screenshots to the photo album instead of automatically processing. When we did that, we saw, that
CGImage.ScreenImage on an iPad with a iPhone-targeted app is only screenshotting the lower left corner of the iPad-screen instead of the app itself. So we see the border which is put around the app in 1x-mode and a litte bit of the lower left corner of the app. We were not able to modify this area.

When we change the code to iPad-target, the full screen is captured without changes to the code. We are thus able to work around but I think, it is a bug, that CGImage.ScreenImage only captures part of the screen when used by an iPhone application on the iPad.

Please check. If a quick fix is available, I would appreciate it, before we have to go the way and create new graphics and such for our app (which ist primarily only useful on a small device but our customers needs to demonstrate it on the iPad).

Best regards from Germany and Keep up the great work

Stefan
Comment 1 Sebastien Pouliot 2011-11-08 09:06:16 UTC
I don't have an iPad2 to "fully" confirm the issue but CGImage.ScreenImage "simply" calls UIGetScreenImage, so it should not be a MonoTouch-specific issue.

		[DllImport (Constants.UIKitLibrary)]
		extern static IntPtr UIGetScreenImage ();
		public static CGImage ScreenImage {
			get {
				return new CGImage (UIGetScreenImage (), true);
			}
		}

However this call has been marked private by Apple and can make them reject your application on their AppStore (google for UIGetScreenImage). This might not be an issue if you're not targeting the appstore.
Comment 2 Sebastien Pouliot 2011-11-08 09:32:03 UTC
The "right" way (according to Apple) is described in this technical note: http://developer.apple.com/library/ios/#qa/qa1714/_index.html

If you can use UIGetScreenImage (non-appstore app) and want to attach a test case, without using a camera, that saves the images to the photo album then I get have a look at it. I, too, find it strange that it does not work on universal applications.
Comment 3 Sebastien Pouliot 2013-06-02 12:58:14 UTC
API were added in 6.0.8 to do this more easily, see:
http://docs.xamarin.com/releases/ios/monotouch_6/monotouch_6.0#MonoTouch_6.0.8