apache / apache/cordova-plugin-screen-orientation

Error CDVOrientation screenOrientation INVALID ["options": [15, any]] on unlock() method in iOS

Open
#85 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
219
Forks
234
PR merge metrics
No merged PRs in 30d

Description

# Bug Report

I am trying to unlock the restricted portrait mode of an Ionic App in just one of the pages.

## Problem

The plugin seems to work perfectly fine on Android yet whenever i try it on iOS i get thrown an error.

### What is expected to happen?

Whenever i enter this page i am calling the unlock() method of the plugin to allow the screen change of orientation

### What does actually happen?

It returns an error such as "To Native Cordova -> CDVOrientation screenOrientation INVALID ["options": [15, any]]" in Xcode and "TypeError: ctx.unlockScreenOrientation is not a function. (In 'ctx.unlockScreenOrientation()', 'ctx.unlockScreenOrientation' is undefined)" in the browser console.

The method lock() also seems to throw the same error at Xcode varying just the number of the options for 12 or 3 depending on the orientation i try to lock to.

### Environment, Platform, Device
I have tested on a physical iPhone 8 device and simulators up to iPhone 12 from the 14.2 software version above

### Version information
"@capacitor/android": "^2.4.5",
"@capacitor/core": "^2.4.6",
"@capacitor/ios": "^2.4.5",
"@ionic-native/core": "^5.0.0",
"@ionic-native/screen-orientation": "^5.34.0",
"@ionic/angular": "^5.0.0",
"cordova-plugin-screen-orientation": "^3.0.2",

## Checklist

- [X] I searched for existing GitHub issues
- [X] I updated all Cordova tooling to most recent version
- [X] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported unlock() and lock() failures on iOS using the listed Capacitor, Ionic, and cordova-plugin-screen-orientation versions, then compare the Xcode and browser-console errors. Done means determining the iOS compatibility issue and either confirming a necessary plugin change or documenting that the reported setup is unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript, objective-c
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.