The screen suddenly turns black

When using my application, the screen sometimes suddenly and inexplicably turns black. The screen is still on, and if I play with volume controls, the volume level indicator will only show up well.

The only way to resolve this is to press the home button, after which I see the following message in my journal:

SpringBoard [15]: Failed to take WaveDeck snapshot

When I open the application again, that’s fine.

Can anyone shed some light on this?

+4
source share
2 answers

Update from the front of WaveDeck:

We used applicationDidEnterBackground in the applicationDidEnterBackground deletion poorly: ask all background operations to finish using beginBackgroundTaskWithExpirationHandler and save the main runloop running inside applicationDidEnterBackground .

Thus, the applicationDidEnterBackground method completed only after completion of all background operations, whether the application was activated again or not.

Thus, it is obvious that the OS was unable to “instantly reduce” the application and appeared for a while on the black screen after returning from the background state - when the delegate function applicationDidEnterBackground ended.

+2
source

I am facing a similar problem. Put the save operation for a long time in the next runloop, so applicationDidEnterBackground returns immediately, the system snapshot mechanism is working correctly.

 - (void)applicationDidEnterBackground:(UIApplication *)application { // don't block ios snapshoting, avoid screen suddenly turns black [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(saveAppState) object:nil]; [self performSelector:@selector(saveAppState) withObject:nil afterDelay:0]; } - (void)saveAppState { [self longtimeSave]; } - (void)applicationWillEnterForeground:(UIApplication *)application { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(saveAppState) object:nil]; } 
0
source

Source: https://habr.com/ru/post/1403951/


All Articles