Search code examples
iosbackgroundnotificationspasswordsresume

Password protection screen on ios is delayed when resuming the app


I'm trying to write a simple password protection screen, but I've noticed that hooking into the didEnterBackground and willEnterForeground have a delay, and you can still see the screen contents for a brief second or so before I get the notification and am able to add the password screen on top. The scenario I want is:

  1. App enters background, add subview to the front so it is on top
  2. App resumes, password window is already on top

It almost seems like you can't do any window operations (like addSubview) during these notifications. Anyone else have this issue?


Solution

  • How about add the password screen earlier, but make it hidden, and not interacting with the user? i.e., set the hidden and userInteractionEnabled properties to TRUE and FALSE, respectively? Then in willEnterForeground, unhide it and enable user interaction?