8.3 C
New York
Thursday, November 21, 2024

swift – iOS 17.5.1 and above, receiving a push notification set off the lifecycle strategies of the primary viewcontroller in background


I’ve an app made a number of years in the past in UIKit that was working effective.

Since iOS 17.5.1 we’re encountering a bizarre downside that’s fully breaking our app.

On this app, within the LoginViewController particularly within the viewDidAppear, if the person is already logged in we immediate the FaceID to login.

For the reason that aforementioned iOS 17.5.1 after I obtain a notification, typically, even when the app is in background, the LoginViewController lifecycle is triggered and all lifecycle strategies are carried out, even the viewDidAppear.

I’ve added some logs to the app they usually verify that the viewDidApper technique is named in background.

by logging these two traces inside viewDidAppear technique:

NSLog("############## (UIApplication.shared.applicationState)")
NSLog("############## viewdidappear")

in console I see:

############## UIApplicationState(rawValue: 2)
############## viewdidappear

and as I see within the UIApplication code the worth 2 means .background

@out there(iOS 4.0, *)
public enum State : Int, @unchecked Sendable {

    case energetic = 0

    case inactive = 1

    case background = 2
}

How is that this attainable?

This behaviour fully break our app, as a consequence of the truth that the app is making an attempt to point out the FaceID immediate whereas in background elevating the LAError.notInteractive error.

The opposite downside is that when the app encounter this behaviour after receiving a notification, even when the app shouldn’t be seen within the multitasking selector, if you open it, it doesn’t set off the anticipated lifecycle strategies as a result of they’re “already triggered” when the app is in background.

The LoginViewController is ready as Preliminary ViewController contained in the Principal.storyboard.

Has somebody encountered this unusual behaviour?

I’ve tried with these three OS model and is going on on all of three iOS 17.5.1, 17.6.1 and 18.1

I do not know if this downside is going on particularly from iOS 17.5.1 however this login logic is written like that from 2018 and has been working flawlessly till 1-2 months in the past and by studying the backend logs we see that the units encountering this difficulty are all 17.5.1 or above.

Thanks prematurely.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles