Closed janusw closed 3 months ago
Note: The GHA build shows the warning
This call site is reachable on: 'iOS' 11.0 and later, 'maccatalyst' 13.0 and later.
'UIApplication.Windows' is obsoleted on:
'ios' 15.0 and later (Use 'UIWindowScene.Windows' in the desired window scene object instead.),
'maccatalyst' 15.0 and later (Use 'UIWindowScene.Windows' in the desired window scene object instead.).
(https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)
However, the call still seems to work on iOS 16 & 17.
Moreover, on the same line, there also is this warning:
This call site is reachable on: 'iOS' 11.0 and later, 'maccatalyst' 13.0 and later.
'UIWindow.WindowScene' is only supported on: 'ios' 13.0 and later.
(https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
I think the warning is incorrect, because the line is guarded by OperatingSystem.IsIOSVersionAtLeast(13)
. AFAICS this is due to the following diagnostic bug: https://github.com/dotnet/roslyn-analyzers/issues/7239
See also: https://github.com/dotnet/maui/issues/21106
Note: The GHA build shows the warning
This call site is reachable on: 'iOS' 11.0 and later, 'maccatalyst' 13.0 and later. 'UIApplication.Windows' is obsoleted on: 'ios' 15.0 and later (Use 'UIWindowScene.Windows' in the desired window scene object instead.), 'maccatalyst' 15.0 and later (Use 'UIWindowScene.Windows' in the desired window scene object instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)
However, the call still seems to work on iOS 16 & 17.
This deprecation warning is fixed in commit 062e8dc3ac59fecc00385fc38a0b5bec38fcc9f4 via the method used in https://www.delasign.com/blog/swift-device-orientation/. This should make the code more future-proof.
As before, I tested this on iOS 16 & 17 (with the front and back camera).
This fixes #19 by using
UIInterfaceOrientation
instead ofUIDeviceOrientation
. Tested on iOS 16.7.6 and 17.4 (with an iPhone and iPad).It also extends the test app to allow all four interface orientations on iPhones (
PortraitUpsideDown
was missing).