swift - iOS 17.5.1 and above, receiving a push notification trigger the lifecycle methods of the first viewcontroller in backgro

I have an app made several years ago in UIKit that was working fine.Since iOS 17.5.1 we are encounteri

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745567878a4633503.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信