跪拜 Guibai
← Back to the summary

iOS 27 Will Crash Apps That Still Skip UISceneDelegate

Welcome to follow the WeChat public account: FSA Full Stack Action 👋

1. Changes and Pitfalls in iOS 27

Over the years, Apple has been "advising" us to use the UIScene lifecycle management model. Although many previous versions have issued warnings, many of our projects have lazily stuck with the old AppDelegate pattern for convenience, since the program ran without any apparent issues anyway.

But with iOS 27 (expected to be released in September 2026), the situation is completely different.

Starting from the iOS 27 SDK, if you are still clinging to the outdated lifecycle management method of UIApplicationDelegate, your app will simply fail to launch. This is not just a warning; it will throw a runtime error, and the program will not run at all.

There is a common misconception that AppDelegate is being deprecated. It's not that drastic. AppDelegate is still responsible for the process-level lifecycle of the application; what has changed is the division of UI-related responsibilities. Simply put, UI window management, lifecycle, multiple scenes, state restoration, and URL handling must now all be managed by UISceneDelegate.

The division of labor between the two is now very clear:

Role Scope of Responsibility
AppDelegate Application Process Lifecycle
SceneDelegate UI Interface Lifecycle

This design was introduced as early as iOS 13, but now Apple intends to make it mandatory.

2. How to Determine if Your App Will Be Affected

The most insidious part of this pitfall is that your code might still compile successfully, and the app can be installed normally on a phone, but as soon as you build it with the iOS 27 SDK, it will crash immediately upon running.

If your project has any of the following situations, it will definitely have problems on iOS 27:

3. Practical Migration Guide

To transition smoothly, we need to look at this migration work based on different scenarios.

1. UIKit Project Migration

If you are doing native UIKit development, the migration logic mainly involves three steps:

First, configure the Scene Manifest You need to add the UIApplicationSceneManifest configuration to your Info.plist. Although most apps currently only need a single window, Apple mandates that you must explicitly declare this lifecycle mode.

Second, relocate lifecycle events Many traditional AppDelegate methods now need to be moved to SceneDelegate. For example:

This is a major trouble spot. Features like Deep Links, Universal Links, and Handoff will now be passed in through SceneDelegate. If the logic is not written correctly, the code won't report an error, but the functionality will simply stop working.

Third, fix API calls Previously, we liked to use UIApplication.shared.windows or UIApplication.shared.keyWindow to get the current window. This approach is no longer reliable in Scene mode. You now need to get the correct window instance through UIWindowScene.

2. Flutter Project Migration

For Flutter developers, the good news is that the Flutter team has already shouldered a lot of the burden for us.

Starting from Flutter 3.41, eligible projects are automatically migrated to the UIScene model during the build process. However, there is a very common pitfall: if your native side has a custom AppDelegate (very common in enterprise-level projects), you must manually move the plugin registration logic into the didInitializeImplicitFlutterEngine callback.

Additionally, any Method Channels or Platform Views that rely on FlutterViewController for startup-phase operations need to be re-examined.

Here is the official Flutter UIScene adaptation documentation: https://docs.flutter.dev/release/breaking-changes/uiscenedelegate

4. Final Recommendations

Although the mandatory requirement for iOS 27 is still some time away, if you wait until then to deal with it, you will definitely be scrambling, especially if you encounter complex Deep Links or Push Notifications callback issues.

My suggested timeline is:

  1. Audit your existing projects first to see if they are still solely relying on AppDelegate.
  2. Set aside some time to create a branch specifically for the migration.
  3. Focus testing on features involving complex lifecycles, such as Universal Links, Push, Background Refresh, and OAuth login.

Compared to the code implementation, more effort should actually be spent on regression testing. Clearing out this technical debt early is much more prudent than scrambling to tackle it right before the deadline.

If the article was helpful to you, please don't hesitate to click and follow my WeChat public account: FSA Full Stack Action, this will be the greatest encouragement for me. The public account covers not only Android technology but also iOS, Python, and other articles, possibly containing skill points you might want to learn~