jailbroken iOS taking screenshot from background app

不打扰是莪最后的温柔 提交于 2020-02-24 13:50:22

问题


I'm building an utility app for myself that can take screenshots of whatever is running in the foreground while this utility is running in the background. The utility will be running on a jailbroken device so it can access private APIs and not confined to the sandbox. Since the utility app is running in the background (either as a daemon or using backgrounder), how can I access the screen being displayed to generate a screenshot?

The reason I want this is because I want to take screenshots programmatically/remotely. The utility will take the screenshot and upload to my local server. I'm using this as part of internal test tools.

Help much appreciated!


回答1:


You should be able to grab a screenshot of the whole screen with UICreateScreenImage(). This will give you a CGImageRef, which you can turn into a UIImage with [UIImage imageWithCGImage:screenshot]. You can then upload this to your server and release the image with CGImageRelease(screenshot).



来源:https://stackoverflow.com/questions/13338416/jailbroken-ios-taking-screenshot-from-background-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!