Prevent sensitive information from appearing in the task switch - Apple code not working - iOS 8 crash?

This document: Preventing sensitive information from appearing in the task switch describes how to present the view controller in applicationDidEnterBackground to hide critical information in the task switch:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Your application can present a full screen modal view controller to
    // cover its contents when it moves into the background. If your
    // application requires a password unlock when it retuns to the
    // foreground, present your lock screen or authentication view controller here.

    UIViewController *blankViewController = [UIViewController new];
    blankViewController.view.backgroundColor = [UIColor blackColor];

    // Pass NO for the animated parameter. Any animation will not complete
    // before the snapshot is taken.
    [self.window.rootViewController presentViewController:blankViewController animated:NO completion:NULL];
}

However, in iOS 8, this exact code does not work, and a simple, simple, black view controller is not displayed until the application becomes active again. The task switcher shows confidential information and doesn't hide anything. There is no animation in this code, so I can’t understand - why is this happening?

+4
1

iOS 8 , .

, , - applicationDidEnterBackground.

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    UIViewController *blankViewController = UIViewController.new;
    blankViewController.view.backgroundColor = UIColor.blackColor;
    [self.window.rootViewController presentViewController:blankViewController animated:NO completion:NULL];
    [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]];
}
+2

All Articles