An iOS developer receives a crash report showing that their app crashed in the AppDelegate applicationDidEnterBackground: method while displaying a modal with sensitive account information. On the crash device, screenshots in the iOS app switcher show the account numbers.
What should the developer do in applicationDidEnterBackground: (or sceneDidEnterBackground:) to prevent sensitive information exposure in the app switcher?
- A.Call UIApplication.shared.ignoreSnapshotOnNextApplicationLaunch() which instructs iOS to skip the snapshot for the current session
- B.Set UIApplication.shared.isIdleTimerDisabled = true in applicationDidEnterBackground: to prevent the device from locking and taking the screenshot
- C.Place an opaque overlay view or blur the window in sceneDidEnterBackground:, and remove it in sceneWillEnterForeground: - or use UIImageView with a placeholder image over the window; this prevents the OS snapshot (used for the app switcher thumbnail) from capturing sensitive content
- D.Implement applicationWillResignActive: and call becomeFirstResponder() to prevent the app from entering background state when sensitive dialogs are open