IOS multitasking image switch video compared to application image violation

It seems to me that the system uses a different screen capture that my applicationWillResignActive uses.

To my surprise, between the picture taken by system (b) and the delay of about 0.6 seconds and the picture taken by the game (d) . Be that as it may, if the system should take a screen capture before applicationWillResignActive , but for a game with fast-moving objects this is easy to notice by the player.

How can I get around this?

Below are the steps a player takes and how he causes such a mismatch:

enter image description here

(a) A player plays a button at home when she is playing. (b) Capturing the system screen. (c) The player removes the game icon. (d) The game starts with a screen capture made on applicationWillResignActive . (e) The game is paused, showing a mismatch in a fast moving object.

+8
ios7 screen-capture multitasking
source share
1 answer

I believe that this is due to the fact that your game rendering is not included in the main stream (of course, it should not be in the main stream), therefore, when applicationDidEnterBackground/applicationWillResignActive returned, the system immediately takes a screenshot from the video card buffer.

At this time, the stream of your game loop is still running, so it may update some frames before it is paused.

I don’t know how you implement your game loop, but you can try the following:

In applicationDidEnterBackground/applicationWillResignActive put the global semaphore ( dispatch_semaphore_t ) and block the main thread, in your game loop, watch the semaphore, and if it exists, pause the game loop and then report the semaphore.

This ensures that a screenshot is taken after pausing the game.

Also note that after applicationWillResignActive system will take a snapshot for the task switcher, and after applicationDidEnterBackground system will take a snapshot the next time the application appears in the foreground.

Hope this helps you.

0
source share

All Articles