镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[Xcode 27] Update Apple app lifecycle and native deployment targets - #136566

Merged
agocke merged 5 commits into
dotnet:mainfrom
matouskozak:matouskozak-apple-test-app-lifecycle
Nov 11, 2026
Merged

agocke merged 5 commits into
dotnet:mainfrom
matouskozak:matouskozak-apple-test-app-lifecycle

Conversation

@matouskozak

@matouskozak matouskozak commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Extract the Apple test-app fixes from #133575 (contributes to #134856). Also fix the Xcode 27 native build.

  • Use the UIScene lifecycle and start the runtime once per process.
  • Raise iOS/tvOS test-app and native deployment targets to 15.0. Native binaries no longer target iOS/tvOS 13–14.
  • Update stale MacCatalyst versions

Note

This PR was updated with GitHub Copilot.

Extract scene-based window creation and once-only runtime startup from dotnet#133575. Raise the iOS/tvOS test-app deployment target to 15.0 without changing runtime support policy.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@matouskozak matouskozak changed the title Use UIScene lifecycle for Apple test apps [XCode 27] Use UIScene lifecycle for Apple test apps Oct 28, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @akoeplinger, @matouskozak, @simonrozsival
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Scene-gated startup across iOS, tvOS, and MacCatalyst needs device or simulator validation of launch, reconnect, and once-only execution that source inspection alone could not provide.

No open issues 🎉

What changed in this PR

Updates AppleAppBuilder’s test-app templates for the Apple 27 rollout tracked in #134856. These changes affect test-app configuration, not .NET’s platform support policy.

Changes:

  • Move window and view-controller creation to the UIScene lifecycle in both templates.
  • Guard runtime startup with dispatch_once to prevent repeated initialization when scenes reconnect.
  • Raise the iOS/tvOS test-app deployment target from 13.0 to 15.0.
File Description
src/​tasks/​AppleAppBuilder/​Xcode.cs Raises the test-app deployment target to 15.0.
src/​tasks/​AppleAppBuilder/​Templates/​main-simple.m Adds scene-based window setup and once-only runtime startup.
src/​tasks/​AppleAppBuilder/​Templates/​main-console.m Adds scene-based window setup and once-only runtime or library-mode startup.

Review effort: Balanced

Align runtime, native libraries, NativeAOT, ReadyToRun, and mobile build defaults with the Xcode 27 SDK minimum. Preserve existing macOS, MacCatalyst, and Android targets.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@matouskozak matouskozak changed the title [XCode 27] Use UIScene lifecycle for Apple test apps [Xcode 27] Update Apple app lifecycle and native deployment targets Oct 28, 2026

Copy link
Copy Markdown
Member

@matouskozak could you also bring the remaining minimum-OS-version references into sync with Directory.Build.props?

The iOS/tvOS minimums in this PR consistently use 15.0, but checking every path in the SetOSTargetMinVersions “keep in sync” comment found these outstanding discrepancies:

File Current minimum Expected minimum
src/coreclr/tools/Common/Compiler/ObjectWriter/MachObjectWriter.cs macOS 12.0; Mac Catalyst 15.2 macOS 14.0; Mac Catalyst 17.0
src/mono/mono/offsets/offsets-tool.py Mac Catalyst 15.2 (both target triples) 17.0
src/tasks/AppleAppBuilder/Xcode.cs Mac Catalyst 15.2 (both IPHONEOS_DEPLOYMENT_TARGET arguments) 17.0
src/tasks/MobileBuildTasks/Apple/AppleProject.cs Mac Catalyst 15.2 17.0

These are pre-existing omissions, not regressions introduced by this PR. The Catalyst mismatch dates to #123200, merged January 25, 2026: it raised MacCatalystVersionMin from 15.2 to 17.0 and updated the native/Mono AOT configuration, but left these four files behind.

There is also a cross-repository follow-up: dotnet/sdk main still uses macOS 12.0 in src/Layout/redist/targets/GeneratePKG.targets, rather than 14.0. The SDK path listed in the Directory.Build.props comment is stale (src/Installer/redist-installer/targets/GeneratePKG.targets) and should be updated to the new location. The SDK value itself would need a separate SDK change.

All other files referenced by that comment match the applicable minimums.

Synchronize macOS and Mac Catalyst deployment references with Directory.Build.props and correct the dotnet/sdk GeneratePKG.targets path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rolfbjarne

Copy link
Copy Markdown
Member

A couple of follow-up items for the UIScene migration:

  1. Two custom NativeMainSource files still use the legacy UIApplicationDelegate lifecycle (didFinishLaunchingWithOptions: + [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]) and will crash at launch on iOS / Mac Catalyst 27 when built with Xcode 27:

    • src/tests/FunctionalTests/iOS/Device/ExportManagedSymbols/main.m
    • src/mono/sample/mbr/apple/main.m
  2. [[UIScreen mainScreen] bounds] in viewDidLoad (src/tasks/AppleAppBuilder/Templates/main-console.m and src/tasks/AppleAppBuilder/Templates/main-simple.m): UIScreen.mainScreen is deprecated and does not necessarily match the scene window size (for example on Mac Catalyst or iPad multitasking). Using self.view.bounds (with appropriate autoresizingMask) would avoid relying on UIScreen.mainScreen.

🤖 Comment posted by Copilot

@matouskozak

Copy link
Copy Markdown
Member Author

@rolfbjarne can I get another look please?

cc: @vitek-karas

Comment thread eng/native/build-commons.sh Resolved
Comment thread Directory.Build.props Resolved
@agocke

agocke commented Nov 3, 2026

Copy link
Copy Markdown
Member

I'd like to move to #136885 first, if possible.

@matouskozak

matouskozak commented Nov 3, 2026 •

Copy link
Copy Markdown
Member Author

I'd like to move to #136885 first, if possible.

Not sure if it's needed because XCode 27 is available only on arm64 images, and we're migrating to the x64 macos-26 but I can wait if you prefer.

Just a note, runtime currently doesn't build if you have XCode 27, which makes the dev loop a bit hard.

@rolfbjarne rolfbjarne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The updated changes in [#136566](#136566) look good to merge:

  • src/mono/sample/mbr/apple/main.m and src/tests/FunctionalTests/iOS/Device/ExportManagedSymbols/main.m: Both custom NativeMainSource files now use UIScene (configurationForConnectingSceneSession:, willConnectToSession:, initWithWindowScene:, and dispatch_once around runtime init).
  • main-console.m, main-simple.m, and src/mono/sample/mbr/apple/main.m: Replaced [[UIScreen mainScreen] bounds] in viewDidLoad with self.view.bounds and added autoresizingMask (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight for full-view controls, UIViewAutoresizingFlexibleWidth for summaryLabel).

No remaining issues found.

Note

GitHub Copilot was here.

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@matouskozak

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@agocke

agocke commented Nov 11, 2026

Copy link
Copy Markdown
Member

/ba-g azure Linux 4 failures unrelated

@agocke
agocke enabled auto-merge (squash) November 11, 2026 17:13
@agocke
agocke merged commit b9c7892 into dotnet:main Nov 11, 2026
198 of 202 checks passed
@matouskozak
matouskozak deleted the matouskozak-apple-test-app-lifecycle branch November 11, 2026 17:15
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants