I have an app made several years ago in UIKit
that was working fine.
Since iOS 17.5.1
we are encountering a weird problem that is completely breaking our app.
In this app, in the LoginViewController
specifically in the viewDidAppear
, if the user is already logged in we prompt the FaceID to login.
Since the aforementioned iOS 17.5.1
when I receive a notification, sometimes, even if the app is killed, the LoginViewController lifecycle is triggered and all lifecycle methods are performed, even the viewDidAppear. All of this without tapping the push notification.
I have added some logs to the app and they confirm that the viewDidApper method is called in background.
by logging these two lines inside viewDidAppear method:
NSLog("############## \(UIApplication.shared.applicationState)")
NSLog("############## viewdidappear")
in console I see:
############## UIApplicationState(rawValue: 2)
############## viewdidappear
and as I see in the UIApplication code the value 2
means .background
@available(iOS 4.0, *)
public enum State : Int, @unchecked Sendable {
case active = 0
case inactive = 1
case background = 2
}
How is this possible?
This behaviour completely break our app, due to the fact that the app is trying to show the FaceID prompt while in background raising the LAError.notInteractive
error.
The other problem is that when the app encounter this behaviour after receiving a notification, even if the app is not visible in the multitasking selector, when you open it, it does not trigger the expected lifecycle methods because they are "already triggered" when the app is in background.
The LoginViewController
is set as Initial ViewController
inside the Main.storyboard
.
Has someone encountered this strange behaviour?
I've tried with these three OS version and is happening on all of three iOS 17.5.1, 17.6.1 and 18.1
I don't know if this problem is happening specifically from iOS 17.5.1
but this login logic is written like that from 2018 and has been working flawlessly until 1-2 months ago and by reading the backend logs we see that the devices encountering this issue are all 17.5.1
or above.
Thanks in advance.