Why does my UIApplicationDelegate receive applicationDidBecomeActive when pulling down notification center?

I've built a bare application with no functionality in XCode, and put logging statements in the applicationDidBecomeActive and applicationWillResignActive methods.


When I swipe down to show the notification center, I see the following:


2018-01-03 10:18:16.867028+0000 BareProject[1165:2053601] Resigning active

2018-01-03 10:18:17.510713+0000 BareProject[1165:2053601] Active

2018-01-03 10:18:17.634805+0000 BareProject[1165:2053601] Resigning active


Is this intended? My code does quite a lot of work when becoming active, only to have the rug pulled out from it again about 120ms later, and it seems that the documentation says I should be using applicationDidBecomeActive to restart tasks:


I tried this on ios 10.3 and this behavior does not exist.

Did you find any work around?, I'm also having the same issue.

I have also noticed this. Can not find anything else about it elsewhere. Would love to get some feedback from Apple engineers. Maybe we need to open a radar ticket?

Please, somebody have some explanations. This happens to me as well and I think this is a really annoying bug.

I noticed that `applicationWillResignActive` was called immediately after that.

I have the same problem too, after two years June 2021, this problem still here. Anyone got solution yet?

Hi

you can use the following to NOT run code in applicationDidBecomeActive when the notification center swipes down

class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?
    var didEnterBackground = true
    ...
    func applicationDidEnterBackground(_ application: UIApplication) {
        didEnterBackground = true
    }
    func applicationDidBecomeActive(_ application: UIApplication) {
            if !didEnterBackground {
                return
            }
            didEnterBackground = false

            // run your code       
    }
    ...
}
Why does my UIApplicationDelegate receive applicationDidBecomeActive when pulling down notification center?
 
 
Q