Face ID authentication via LAContext may not always result in App lifecycle notifications

When a user swipes up to see the app switcher, I put a blocking view over my app so the data inside cannot be seen if you flick through the app switcher. I do this by receive notifications(UIApplicationDidBecomeActiveNotification, UIApplicationWillResignActiveNotification)

But on my iPhone 16 Pro, iOS 18.4.1 test device, Face ID authentication via LAContext may not always result in App lifecycle notifications.This caused my blocking view not to be removed.

any ideas about the notification changes caused by Biometric authentication?

I do this, too.

Is your app written in Swift or ObjC?

I use something like this:

@Environment(\.scenePhase) private var scenePhase
...
.onChange(of: scenePhase) {
if(scenePhase == .active) {
// Remove blocking view
} else if(scenePhase == .inactive) {
// Add blocking view
}
}

Also, make sure you're using a new LAContext() every time you need to use it. I was using a global context and it only worked sporadically.

ObjC.

My situation may be a little different.

When the face id authorization pops up, the app enters the inactive state, but after the face id authorization login ends, the app does not return to the active state. The app did not receive the UIApplicationDidBecomeActiveNotification notification, so the blocking view was not removed. The probability of this exception is very low.

In addition, I have tried to violently click on the face id authorization login. After repeated calls, the inactive and active life cycles of AppDelegate will not be called, and I will no longer receive UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification notifications. The probability of exceptions in this case is relatively high.

Is your app written in Swift or ObjC?

Did you try the scenePhase change? it might fix your issue. If you don't even attempt anything we suggest, then we're not really going to get anywhere.

Face ID authentication via LAContext may not always result in App lifecycle notifications
 
 
Q