我正在为自己构建一个实用程序应用程序,该应用程序可以在该实用程序在后台运行的同时,对在前台运行的任何内容进行截图.该实用程序将在越狱设备上运行,因此它可以访问私有API,而不仅限于沙盒.由于该实用程序应用程序在后台运行(作为守护程序或使用后台程序),如何访问正在显示的屏幕以生成屏幕截图?
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.
非常感谢您的帮助!
推荐答案您应该可以使用 UICreateScreenImage() .这将为您提供CGImageRef,您可以使用[UIImage imageWithCGImage:screenshot]将其转换为UIImage.然后,您可以将其上传到服务器并使用CGImageRelease(screenshot)释放图像.
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).
更多推荐
越狱的iOS从后台应用获取屏幕截图
发布评论