이 문서 : Preventing Sensitive Information From Appearing In The Task Switcher이 작업 전환기에 중요한 정보를 숨길 수 있도록 applicationDidEnterBackground :와의 뷰 컨트롤러를 제공 할 수있는 방법을 설명합니다 아이폰 OS 8,중요한 정보가 작업 전환기에 나타나지 않도록 방지 - Apple 코드가 작동하지 않음 - iOS 8 결함이 있습니까?
- (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];
}
그러나이 정확한 코드는 매우 작동하지 않습니다 앱이 다시 활성화 될 때까지 단순, 일반, 검정보기 컨트롤러가 표시되지 않습니다. 작업 전환기는 중요한 정보를 보여 주며 숨겨진 것도 없습니다. 이 코드에는 애니메이션이 없으므로 이해할 수 없습니다 - 왜 이런 일이 발생합니까?
내 경우에는 코드 종류가 작동합니다 ... 많은 경우에 "효과가 없어지면"효과가 나타나지만 모달보기가있는 경우에는 제대로 작동하지 않습니다. – moliveira
"경고 :에있는보기가 창 계층 구조에 있지 않은 을 표시하려고 시도합니다!"라는 메시지가 나타납니다. –
moliveira
FYI 제안 된 rootViewController() 대신 UIWindow.topMostController()를 사용하여 모달 뷰 문제 해결 – moliveira