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.
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
controllerinapplication:didFinishLaunchingWithOptions:. The reason is thatwindowis stillnilat this point in time.Expected fix
setMethodCallHandlershould be called later, f.i. withinscene(_:willConnectTo:options:). The needed arguments can there be determined withwindow?.rootViewController as? FlutterViewController´ andUIApplication.shared.delegate as? AppDelegate`.Additional context
I have tested the solution based on
UISceneDelegateas 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.