For testing purposes, in the running app (not in a UI test), I'd like to take a true screenshot of the device with my app running, programmatically. I'm calling
let snapview = UIScreen.main.snapshotView(afterScreenUpdates: true)
but the resulting image omits screen elements imposed by the system such as the status bar, the home "bar" at the bottom of a bezel-free device, etc. I'm guessing that this is deliberate for security reasons; I have the sense that Apple used to include those elements and no longer does so.
So am I just out of luck? Is there no way for my app to get an image of the screen as it actually appears?