title: iOS Face ID/Touch ID Lock Screen Conflict in willEnterForegroundNotification
body: <p>I have code that puts a blurred <code>UIVisualEffectView</code> over the current window when the <code>didEnterBackgroundNotification</code> notification is fired. It then tries to reverse this when <code>willEnterForegroundNotification</code> is fired (simplified for easy reading):</p>
  
  <pre><code>class AutoBlur {
      init() {
          NotificationCenter.default.addObserver(self, selector: #selector(appDidEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)
          NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
      }
  
      @objc func appDidEnterBackground() {
          blur()
      }
  
      @objc func appWillEnterForeground() {
          guard UserState.isScreenLockEnabled else {
              unblur()
              return
          }
          let authContext = LAContext()
          authContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "test") { success, error in
              DispatchQueue.main.async {
                  guard success else {
                      return
                  }
                  unblur()
              }
          }
      }
  
      //...
  }
  </code></pre>
  
  <p>While this approach generally works, when testing the Face ID functionality of app I found the following anomaly:</p>
  
  <ol>
  <li>Open the app</li>
  <li>Turn the screen off on the device</li>
  <li>Wake the device</li>
  <li>Swipe up on the device's lock-screen</li>
  </ol>
  
  <p>Expected results: The device should unlock, and then my app should run its Face ID evaluate code to un-blur the view.</p>
  
  <p>Actual results: The swipe-up action is undercut by my app's Face ID evaluation code. It prevents the user from being able to swipe up on their lock-screen, effectively locking them out of their device.</p>
  
  <p>Is there some state I should be monitoring or some other event that's safer to respond to for triggering my Face ID evaluation?</p>