Skip to content

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented May 23, 2025

BREAKING CHANGE

Adopting Apple's UISceneDelegate protocol shifts the initialization order of apps. For the common cases we've made sure they will work without change. The one case that will require a change is any app that in -[UIApplicateDelegate didFinishLaunchingWithOptions:] assumes that UIApplicationDelegate.window.rootViewController is a FlutterViewController instance. Users should follow the migration guide to update that usage.

Changes since revert

It's been rebased onto the FlutterPluginRegistrant PR which was used for migration. The dynamic selection of the UISceneDelegate has been removed, instead there is a flutter tool migration to the Info.plist.

Description

fixes: #167267

design doc:

https://docs.google.com/document/d/1ZfcQOs-UKRa9jsFG84-MTFeibZTLKCvPQLxF2eskx44/edit?tab=t.0

relands #168396
relands #168914
relands #169276

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added platform-ios iOS applications specifically engine flutter/engine related. See also e: labels. d: examples Sample code and demos team-ios Owned by iOS platform team labels May 23, 2025
@gaaclarke gaaclarke force-pushed the reland-uiscenedelegate-3 branch from b89bd9e to 8fcd82f Compare May 28, 2025 17:27
@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 28, 2025
@gaaclarke gaaclarke marked this pull request as ready for review May 28, 2025 22:20
@gaaclarke gaaclarke requested a review from a team as a code owner May 28, 2025 22:20

func register(with registry: FlutterPluginRegistry) {
GeneratedPluginRegistrant.register(with: registry)
let registrar = registry.registrar(forPlugin: "battery")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vashworth I think I may have misspoken. I was thinking we could get rid of this since we would be sending the FlutterViewController. I decided to send the FlutterPluginRegistry though since that makes more sense to send the abstraction that is more apropos. We could potentially allow people to get the binary messenger from the FlutterPluginRegistry if we wanted to get rid of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have to issue breaking changes, we might as well introduce a registry.registrar(forChannel:) for sanity

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registry.registrar(forChannel:) wouldn't quite be the right API since a registrar has a BinaryMessenger which you specify the channel name on.

Registry.binaryMessenger would be the convenience we want but that completely circumvents the need for the registrar.

I think Registry.unaffiliatedRegistrar would probably be what we want, something like that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you are fine with shelving this decision for later since it's a convenience that will be added to the existing API. The PR in it's current state is just using what is already present.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya I think we can leave it. Maybe add some comments to registrar(forPlugin:) saying it's also ok for non-plugins? Or explain in the instruction website?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get the FlutterViewController and get the binary messenger from it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get the FlutterViewController and get the binary messenger from it?

If someone has a FlutterViewController they can get the binary messenger and the FlutterViewController is a FlutterPluginRegistry. There's no concept the represents both of those things. Having them both doesn't make sense because accessing the binary messenger invalidates the need for a registrar.

Making register callback send in a FlutterViewController would make that possible, but I didn't want to do that because that leaves us tied to a concrete class which gives us less options in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay last ditch comment: I really dislike using forPlugin, it's confusing since it's not a plugin. Plugin means something specific in Flutter, so I think it'd be confusing for users too.

From my understanding, forPlugin is used to get the registrar to hook up a method channel with the plugin and/or publish the plugin. With this use case, we never intend to do those things.

What if we have another method called registrarForKey, which basically does the same under the covers but has a slightly different intention?
Maybe something like this:
master...vashworth:flutter:registar_for_key

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is overloading the concept of a plugin name and a key now, which are functionally the same. We know that but it is confusing to someone. "Can you have a key and a plugin name with the same values?"

It also makes people have to come up with a key which they didn't have to in the past. I think FlutterPluginRegistry.registrar is better. It just gives you an unincorporated registrar, which matches the semantics we had previously.

We have to think hard if we want to continue to support that though.

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. left some comments


func register(with registry: FlutterPluginRegistry) {
GeneratedPluginRegistrant.register(with: registry)
let registrar = registry.registrar(forPlugin: "battery")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have to issue breaking changes, we might as well introduce a registry.registrar(forChannel:) for sanity

@vashworth
Copy link
Contributor

@gaaclarke I think this still needs a warning somewhere in the engine that checks if they've adopted the UIScene lifecycle, like the UIKit warning that points to documentation on how to migrate. Is that possible?

@gaaclarke
Copy link
Member Author

@gaaclarke I think this still needs a warning somewhere in the engine that checks if they've adopted the UIScene lifecycle, like the UIKit warning that points to documentation on how to migrate. Is that possible?

@vashworth I just added an issue for that above: #169678. It has the same problem as the static check that we want to link to the migration guide.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2025
sfshaza2 added a commit to flutter/website that referenced this pull request Jun 4, 2025
## _Description of what this PR is changing or adding, and why:_

Adding breaking change notice for UISceneDelegate adoption.

## _Issues fixed by this PR (if any):_

flutter/flutter#167267

## _PRs or commits this PR depends on (if any):_

flutter/flutter#169365

## Presubmit checklist

- [x] This PR is marked as draft with an explanation if not meant to
land until a future stable release.
- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style) — for example, it
doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
of 80 characters or fewer.

---------

Co-authored-by: Victoria Ashworth <15619084+vashworth@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Parker Lougheed <parlough@gmail.com>
sfshaza2 pushed a commit to flutter/website that referenced this pull request Jun 4, 2025
… usage (#12095)

## _Description of what this PR is changing or adding, and why:_

Updating platform channel guidance to be inline with the breaking
change: #12082

## _Issues fixed by this PR (if any):_

## _PRs or commits this PR depends on (if any):_

flutter/flutter#169365
#12082

## Presubmit checklist

- [x] This PR is marked as draft with an explanation if not meant to
land until a future stable release.
- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style) — for example, it
doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
of 80 characters or fewer.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
@definev
Copy link

definev commented Jun 9, 2025

This PR break deep link in Flutter

@gaaclarke
Copy link
Member Author

This PR break deep link in Flutter

We had to fix shortcuts with a special message forwarding (#170180). Maybe we need to do the same thing for deep linking, can you file an issue please @definev

@gnprice
Copy link
Member

gnprice commented Jun 10, 2025

@rajveermalviya has filed that deep-links issue here:

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d: examples Sample code and demos engine flutter/engine related. See also e: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UIScene warning in Xcode CLIENT OF UIKIT REQUIRES UPDATE: This process does not adopt UIScene lifecycle. This will become an assert in a future version.
5 participants