iOS13から、アプリがバックグラウンドに入った時に呼び出されるメソッドは、AppDelegateクラスではなく、SceneDelegeteクラスのsceneWillResignActive(_:)メソッドとsceneDidEnterBackground(_:)になったようです。
参考資料のURLでは、iOS13でもAppDelegateで呼び出されるようにできるような設定が書かれています。
SceneDelegate.swift
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
print("sceneWillResignActive")
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
print("sceneDidEnterBackground")
}
}
