I am developing a monitoring application for the iPad. It already uses private frameworks to send artificial events and simulate user input, while my application is in the background and another application in the foreground.
Now my problem is: I need to take a screenshot of the iPad as an image programmatically. I know the UIGetScreenImage method, as well as each view on the screen, to get an image. However, UIGetScreenImage cannot be called from the background. (I get an error when I try to do this from the background) And I cannot display the views from another application, since I only know my applications.
OPTION 1 I can simulate a click on the house and lock the keys so that the iPad can create a screenshot. Subsequently, I use private APIs to access this image from my photo album using [PLPhotoLibrary] (https://github.com/nst/iOS-Runtime-Headers/blob/3686717e107fa36a990fac20c30da2da9a25b698/PrivateFrameworks/PhotoLibhotolibrary.frameP workbook and PLPhoto .
id lib = [PLPhotoLibrary sharedPhotoLibrary]; id allPhotosAlbum = [lib allPhotosAlbum]; id contents = [lib albumContents]; id lastPhoto = [contents objectAtIndex:[contents count] -1]; UIImage *screenshot = [lastPhoto newFullSizeImage];
The only problem with this approach is that the screenshots will be stacked on the album, filling the memory of the iPad. So I need another way, or I need a way to delete these photos. But when I call the delete methods in the photo album and photo library, I get a "SQLITE 8 error [attempt to write to the read-only database]
Any suggestions on how to achieve this screen shot better would be appreciated.
I will not upload this application to the application store. This is for private use.
source share