Creating an image out of the ios surface and saving it

别说谁变了你拦得住时间么 提交于 2019-11-28 10:39:00
Victor Ronin

I remember I saw something on this subject (taking screenshots in the background) some time ago. I wasn't able find exact place and code which I saw. The only note which I left for myself was usage of createScreenIOSurface

I googled a little bit and found couple of mentions:

Get a screenshot while App is in background? (Private APIs allowed)

https://github.com/rpetrich/FastBlurredNotificationCenter/blob/master/Tweak.x

http://pastie.org/pastes/3734430

As I remember the code was way more compact then what you showed.

The specified code works if you run it in the background. It does take screenshot of the topmost surface on the display of iOS device.
The problem faced was due to the fact that inside the app, it was taking screenshot of the blank view created for the app.
However, you have to take the screenshots at minimum intervals of 2 sec otherwise the OS suspends your app. Any suggestions on how to improve that will be helpful.

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