iOS Lifecycle: Handling willEnterForeground in AppDelegate and SceneDelegate

Hope you guys already know that we need to migrate to scene-based life cycle in near future.

Below lines are written in this reference document provided by Apple.

In iOS 18.4, iPadOS 18.4, Mac Catalyst 18.4, tvOS 18.4, visionOS 2.4 and later, UIKit logs the this message for apps that haven’t adopted the scene-based life-cycle.

This process does not adopt UIScene lifecycle. This will become an assert in a future version.

Soon, all UIKit based apps will be required to adopt the scene-based life-cycle, after which your app won’t launch if you don’t. While supporting multiple scenes is encouraged, only adoption of scene life-cycle is required.

Here I am discussing about the methods applicationWillEnterForeground and sceneWillEnterForeground actually work same or not? As there are key differences let’s discuss in detail.

Key Differences

1. App-wide vs Scene-specific

  • AppDelegate version:
    Runs once when your whole app comes back from the background to foreground.
  • SceneDelegate version:
    Runs for each scene that becomes active.
    (This matters more if your app supports multiple windows/scenes.)

So, the SceneDelegate’s sceneWillEnterForeground method may be called more than once, means one for each scene that’s becoming active.

2. Fresh App Launch

When you open the app from scratch:

  • AppDelegate‘s – applicationWillEnterForeground will not be called
  • SceneDelegate‘s – sceneWillEnterForeground method will be called!

So right from the start, they behave differently.

Conclusion

  • Be careful when moving code:
    If you’re switching code from AppDelegate to SceneDelegate, remember it might run multiple times (once for each scene).
  • Don’t treat them the same:
    Just because the method names sound similar doesn’t mean they act the same -especially when starting the app.
  • No need to rush:
    AppDelegate is still supported, so you don’t have to refactor everything right away.
  • Test it yourself:
    Always check the official documentation and try it in your app before making big changes.

Let me know if you have any questions, comments, or feedback – via X (Twitter) or LinkedIn.

Happy Coding 🙂