Skip to content

Explicitly setting device orientation in iOS 16 emits a warning: Attempting to set an orientation on UIDevice via setValue:forKey: isn’t supported and no longer works. #111587

@soarescaique

Description

@soarescaique

Steps to Reproduce

According to iOS16 Release note:

"Attempting to set an orientation on UIDevice via setValue:forKey: isn’t supported and no longer works."

After update my system to iOS16 ( Version 16.0 ) if you try to change the screen orientation, you will get the following warning.

Expected results:

The screen orientation changes without any warnings.

Actual results:

BUG IN CLIENT OF UIKIT: Setting UIDevice.orientation is not supported. Please use UIWindowScene.requestGeometryUpdate(_:)

Code example:

 @override
  void initState() {
    SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]); // This line reproduces the bug

    super.initState();
  }

Flutter Doctor:

[✓] Flutter (Channel stable, 3.3.2, on macOS 12.6 ---- darwin-arm, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.71.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: layoutSystemChrome and Framework's Layout Issuese: OS-version specificAffects only some versions of the relevant operating systemengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions