Creating an image out of the ios surface and saving it

后端 未结 2 731
耶瑟儿~
耶瑟儿~ 2020-12-10 10:18


I am trying to acquire the surface associated with the main screen of the ios device, create an image out of it and save it. This is in relevance to this question - Ta

相关标签:
2条回答
  • 2020-12-10 10:31

    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.

    0 讨论(0)
  • 2020-12-10 10:44

    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.

    0 讨论(0)
提交回复
热议问题