gaaclarke 3d8fa621c1
[Reland3] Implements UISceneDelegate dynamically w/ FlutterLaunchEngine (#169276) (#169365)
## **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](https://docs.google.com/document/d/16WsqYbANmhupw-gxGPQPZ9B3yz1YBIviS-N1UyIQNSE/edit?tab=t.0#heading=h.txry2otwqko3)
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: https://github.com/flutter/flutter/issues/167267

design doc:


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

relands https://github.com/flutter/flutter/pull/168396 
relands https://github.com/flutter/flutter/pull/168914
relands https://github.com/flutter/flutter/pull/169276

## Pre-launch Checklist

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

iOS Unit Tests

These are the unit tests for iOS engine. They can be executed locally and are also run in LUCI builds.

Running Tests from command line

To build and run the iOS tests, use the run_tests script from the src directory.

flutter/testing/run_tests.py --type=objc

And if you're on Apple Silicon:

./flutter/testing/run_tests.py \
  --type=objc \
  --ios-variant ios_debug_sim_unopt_arm64

The .xcresult is automatically removed after testing ends. To change this:

export FLUTTER_TEST_OUTPUTS_DIR=~/Desktop

To learn more:

flutter/testing/run_tests.py --help

Running Tests from Xcode

After the ios_test_flutter target is built you can also run the tests inside of Xcode with testing/ios/IosUnitTests/IosUnitTests.xcodeproj.

When you load the test project IosUnitTests.xcodeproj into Xcode after running run_tests.py, only a few basic tests will appear initially. You have to run the test suite once in Xcode for the rest to appear. Select "iPhone 11" as the device, and press command-u to start all the tests running. Once the tests are done running, the tests that ran will appear in the sidebar, and you can pick the specific one you want to debug/run.

If you modify the test or under-test files, you'll have to run run_tests.py again.

Adding Tests

When you add a new unit test file, also add a reference to that file in shell/platform/darwin/ios/BUILD.gn, under the sources list of the ios_test_flutter target. Once it's there, it will execute with the other tests.