Closed kapchew closed 1 year ago
Hi There, I am also facing same issue, particularly in iOS 16.4 and above devices. Below iOS 16.4, the plugin works fine. In iOS 16.4 XCode debug console prints error:
Native: tried calling Screen Orientation.lock, but the Screen Orientation plugin is not installed.
Essentially, the it is not calling the plugin method at all. Breakpoints doesn't hit.
Is there any update/solution for this?
If someone can at least point me why it would throw error plugin not installed, I can work on this issue to address this.
Thank you!
Facing similar issue while trying to open camera in application.
ERROR: Unhandled Promise rejection: plugin_not_installed ; Zone: ; Task: Promise.then ; Value: plugin_not_installed WARN: Native: tried calling ScreenOrientation.lock, but the ScreenOrientation plugin is not installed. WARN: Install the ScreenOrientation plugin: 'ionic cordova plugin add cordova-plugin-screen-orientation' ERROR: Unhandled Promise rejection: plugin_not_installed ; Zone: ; Task: Promise.then ; Value: plugin_not_installed WARN: Native: tried calling ScreenOrientation.lock, but the ScreenOrientation plugin is not installed. WARN: Install the ScreenOrientation plugin: 'ionic cordova plugin add cordova-plugin-screen-orientation' ERROR: Unhandled Promise rejection: plugin_not_installed ; Zone: ; Task: Promise.then ; Value: plugin_not_installed
This issue is occure after getting update of ios version 16.4 and 16.5, on lower version i'm able to access camera easily.
Below plugin used for
"cordova-ios": "^6.3.0", "@ionic-native/camera-preview": "^5.27.0", "cordova-plugin-camera-preview": "^0.12.3", "cordova-plugin-screen-orientation": "^3.0.2"
Reference link for similar issue : https://github.com/ionic-team/capacitor/issues/6459
Implemented this change on local but not working : https://github.com/apache/cordova-plugin-screen-orientation/commit/f8479d5c7bc938edf782bf4ebcedc0cfa8ceb7e8
Can you help me on this any pointers on same it will help full for me.
Thanks in advance.
Hi- I'm also seeing this issue when building my app. Luckily upgrading to 16.5 on devices that already have the app installed does not cause them to fail. If I put the call to screen.orientation.lock() in a try/catch block I get the following exception:
TypeError: window.screen.orientation.lock is not a function. (In 'window.screen.orientation.lock(e)', 'window.screen.orientation.lock' is undefined)
I'm looking into a workaround.
I've been tinkering a little and notice that changing
screenObject.lock = function (orientation) {
to
ScreenOrientation.prototype.lock = function (orientation) {
fixes the problem of the lock function being undefined. I'm not sure how iOS versions less than 16.4 will handle this, so more testing needed.
ScreenOrientation.prototype.lock
Great find! Please let us know when you have news about previous versions, I will try to find an old iphone to test as well....
Nope, unfortunately the workaround doesn't work on older iOS versions. So we have to do this: www/screenorientation.js, around line 98:
if (typeof ScreenOrientation != 'undefined') {
addScreenOrientationApi(ScreenOrientation.prototype);
}
else {
addScreenOrientationApi(screen.orientation);
}
This works for me on iOS 16.5 and also 15.7
Due to xcode version update from 14.2 to 14.3 we are facing this issue, Again we moved from 14.3 to 14.2 issue is resolved, don't know what is update in xcode version but after downgrade xcode version resolved my issue.
Is there an update about this issue? Facing the same issue.
Is there maybe a work around to force the app to Landscape mode?
Is there an update about this issue? Facing the same issue.
Is there maybe a work around to force the app to Landscape mode?
Look at the comment from ragcsalo, if you're able to edit that one js file, it solves the issue. I would consider this a workaround, but it's fine until the plugin author releases an update.
I just forced orientation to landscape of the whole app in xcode, that worked for me
Nope, unfortunately the workaround doesn't work on older iOS versions. So we have to do this: www/screenorientation.js, around line 98:
if (typeof ScreenOrientation != 'undefined') { addScreenOrientationApi(ScreenOrientation.prototype); } else { addScreenOrientationApi(screen.orientation); }
This works for me on iOS 16.5 and also 15.7
Fantastic this did indeed do the trick! Important is that you edit the correct screenorientation.js file :-)
any idea how long it will take for the updated version of plugin?
Hi guys. There is a PR to fix it. How soon it can be merged? @maverickmishra @purplecabbage @alsorokin @janpio
Resolved in #116
Issue Type
Description
When testing in iOS 16.4 and 16.5, code execution stops at screen.orientation.lock();
Environment, Platform, Device
MacBook Pro M1 + iPad
Version information
Cordova CLI 11 cordova-ios 6.3 cordova-plugin-screen-orientation 3.0.3
Checklist