Skip to content

iOS version of Example crashes on iOS 26 #13243

@p0mmy

Description

@p0mmy

Page URL

https://docs.flutter.dev/platform-integration/platform-channels

Page source

https://github.com/flutter/website/blob/main/src/content/platform-integration/platform-channels.md

Describe the problem

The iOS version (Step 4) of the example crashes on iOS 26 when determining the controller in application:didFinishLaunchingWithOptions:. The reason is that window is still nil at this point in time.

Expected fix

setMethodCallHandler should be called later, f.i. within scene(_:willConnectTo:options:). The needed arguments can there be determined with window?.rootViewController as? FlutterViewController´ and UIApplication.shared.delegate as? AppDelegate`.

Additional context

I have tested the solution based on UISceneDelegate as above on iOS 18 and iOS 26. It may even work down to iOS 13, but I have no device to verify.

I would like to fix this problem.

  • I will try and fix this problem on docs.flutter.dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    from.page-issueReported in a reader-filed concernp2-mediumNecessary but not urgent concern. Resolve when possible.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions