applicationDidEnterBackground are not called on iOS 13

I made new project on Xcode 11 beta 7 and add this code in AppDelegate.swift.

func applicationDidEnterBackground(_ application: UIApplication) {
        NSLog("%@", #function)
    }


Run app on device / simulator and go back to home screen, however applicationDidEnterBackground are not called and I got this message on debugger.

(I didn't implement codes related background task.)

Can't end BackgroundTask: no background task exists with identifier 1 (0x1), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.


Has anyone else experienced this problem?

Accepted Reply

New projects created by Xcode 11 are configured to use the new scene-based lifecycle. The "old" app delegate lifecycle methods are not called in apps that uses scenes. There are similar lifecycle methods in the scene delegate that are called instead. WWDC 2019 212: Introducing Multiple windows on iPad discusses this (and much more).

Replies

New projects created by Xcode 11 are configured to use the new scene-based lifecycle. The "old" app delegate lifecycle methods are not called in apps that uses scenes. There are similar lifecycle methods in the scene delegate that are called instead. WWDC 2019 212: Introducing Multiple windows on iPad discusses this (and much more).

Thank you!
The remaining problem is the misterious BackgroundTask error message.
I'll start new discussion about this with new title.