MAS rejection while do a screenshot with ScreenshotRectMBS

My application “Acana Date Calculator” is on the AppStore since many years. Yesterday I made a new release and today it was rejected by the App Store review team, because it makes a screenshot of itself.

It is not appropriate for the app to request Screen Recording access for the functionality of taking a screenshot of the app’s UI.
We look forward to reviewing your revised binary.

Screenshot is done by ScreenshotRectMBS

Reviewer is with spyware feelings.

Feelings, nothing more than feelings, Feelings, wo-o-o feelings, Wo-o-o

While you can’t screenshot other content (without special permissions) an app should be able to screenshot it’s own windows without problem. Have you tried https://documentation.xojo.com/api/deprecated/window.html#window-drawinto instead?

I would love funny integrated emoticons in the forum. I would choose one right now. :smiley:

The reviewer disagreed. Hmmm, he said “Screen Recording access”. Something is wrong with your project.

No, the reviewer and I are in agreement. Screen recording is not the same thing as capturing the content of an app’s own windows. ScreenshotRectMBS uses screen recording facilities under the hood.

Yep. As I noticed and reported.

Window.DrawInto makes not a good solution, because the picture is not useable when using “Dark Mode”.

Dark Mode:

None Dark Mode:

Apple is right. To take screenshot, we need to use APIs to Render screenshots.

You may want to use functions in CGWindowMBS module directly and only request picture of your own window. Then it may go through.

Interesting - I wonder if that’s a Xojo or OS-level bug?

I use screenshot code in HDRtist NX, for the white balance selector. If you need me to, I can take at a look at what declares I used to do it.

Albeit if you’ve only just got this rejection, I don’t know how viable it is until my app goes through review again.

My application now use the “CGWindowMBS” to create a screenshot and no longer use “ScreenshotMBS”. The build-in “Window.DrawInto” makes ugly screenshots and it doesn’t make a HiDPI picture.

My application wa now release in MAS this morning.

excellent. I hope the app is successful!

It does make a HiDPI Picture. At least, if you’re creating a HiDPI Picture. But of course you can also (by mistake/accident) create a Picture with ScaleFactor 1, and that will of course result in a “blurry result” since .DrawInto then needs to scale the “Retina display” contents down to the low-res Picture.

By “not useable” you probably mean that the “Background” is Transparent?
I can’t say if that’s “by design” or not…

…but you could just fill the Background first, and then use .DrawInto:

Dim oWindowScreenShot As Picture = self.TrueWindow.BitmapForCaching(self.TrueWindow.Width, self.TrueWindow.Height) oWindowScreenShot.Graphics.ForeColor = FillColor oWindowScreenShot.Graphics.FillRect(0, 0, oWindowScreenShot.Graphics.Width, oWindowScreenShot.Graphics.Height) self.TrueWindow.DrawInto(oWindowScreenShot.Graphics, 0, 0) oWindowScreenShot.Save(SpecialFolder.Desktop.Child("WindowScreenShot.png"), Picture.SaveAsPNG, Picture.QualityMax)

While you have your solution using MBS, maybe this still helps others that need a way with Xojo-built-in functions.

1 Like

Thanks for the code Jürg, but there seems to be one limitation/bug.

FillColor seems to keep the value of when the Window was opened. Switching from Light to Dark modes and taking a new screenshot will result on white text for labels on a light background.

Ah right - thanks for the reminder :wink: That’s <https://xojo.com/issue/54786>.
That’s what happens if everyone needs to implement workarounds in own projects… I’ve forgotten to add this to a “new/simple example project / code snipplet” :wink:

What you need to additionally do: Manually cache the “current ‘real’ FillColor”. As an example:

  • Add a Property to Window1 (or a global Module): MyCurrentFillColor As Color
  • Implement Window1.Paint Event, and just add: MyCurentFillColor = FillColor (since FillColor is called from within a Paint-Event, it will have the desired/real/actual Color *)
  • in the Window .DrawInto code snipplet (see above), change FillColor to MyCurrentFillColor

I think that’s the best you can currently get with current Xojo built-in functions…
*) it is still a bit off in DarkMode… that’s why I’ve written: the best you can currently get without Plugins/Declares