Remove sensitive information from views before moving to the
background. When an application transitions to the background, the
system takes a snapshot of the application’s main window, which it
then presents briefly when transitioning your application back to the
foreground. Before returning from your applicationDidEnterBackground:
method, you should hide or obscure passwords and other sensitive
personal information that might be captured as part of the snapshot.
In swift 4 add this code to your app delegate.
Declare a variable in app delegate
var imageview : UIImageView?
func applicationWillResignActive(_ application: UIApplication) {
imageview = UIImageView.init(image: UIImage.init(named: "bg_splash"))
self.window?.addSubview(imageview!)
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidBecomeActive(_ application: UIApplication) {
if (imageview != nil){
imageview?.removeFromSuperview()
imageview = nil
}
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}