Skip to content

Commit

Permalink
fix(screen-orientation): `None of the requested orientations are supp…
Browse files Browse the repository at this point in the history
…orted by the view controller` error on iOS (capawesome-team#101)
  • Loading branch information
robingenz authored Dec 13, 2023
1 parent bf8935b commit 89ab014
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-trainers-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 1,5 @@
---
'@capawesome/capacitor-screen-orientation': patch
---

fix(ios): `None of the requested orientations are supported by the view controller` error
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 30,9 @@ import Capacitor
strongSelf.requestGeometryUpdate(orientationValue: nextOrientationValue, orientationMask: nextOrientationMask)
ScreenOrientation.supportedInterfaceOrientations = nextOrientationMask
UINavigationController.attemptRotationToDeviceOrientation()
strongSelf.requestGeometryUpdate(orientationValue: currentOrientationValue, orientationMask: currentOrientationMask)
if #unavailable(iOS 16) {
strongSelf.requestGeometryUpdate(orientationValue: currentOrientationValue, orientationMask: currentOrientationMask)
}
strongSelf.notifyOrientationChangeListeners(orientationType)
completion()
}
Expand All @@ -55,7 57,7 @@ import Capacitor
}
completion(cachedOrientationType)
}

@objc private func requestGeometryUpdate(orientationValue: Int, orientationMask: UIInterfaceOrientationMask) {
if #available(iOS 16, *) {
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
Expand Down Expand Up @@ -98,7 100,7 @@ import Capacitor
self.currentOrientationType = orientationType
self.plugin.notifyOrientationChangeListeners(orientationType)
}

@objc private func convertOrientationValueToMask(_ orientationValue: Int) -> UIInterfaceOrientationMask {
switch orientationValue {
case UIInterfaceOrientation.landscapeLeft.rawValue:
Expand Down

0 comments on commit 89ab014

Please sign in to comment.