Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screen orientation lock does not work on iOS 12.x (ionic 4 with capacitor) #1061

Closed
ryaa opened this issue Dec 19, 2018 · 10 comments · Fixed by #1062
Closed

screen orientation lock does not work on iOS 12.x (ionic 4 with capacitor) #1061

ryaa opened this issue Dec 19, 2018 · 10 comments · Fixed by #1062

Comments

@ryaa
Copy link
Contributor

ryaa commented Dec 19, 2018

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/

Current behavior:

Screen Orientation is not locked on iOS 12.x
XCode console shows

⚡️  [log] - Current screen orientation portrait-primary
To Native Cordova ->  CDVOrientation screenOrientation INVALID ["options": [3, portrait]]

Expected behavior:

Must lock the orientation

Steps to reproduce:

Related code:
In my component I invoke

this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);

Please note that i use capacitor to support native features. The same code works fine in ionic 3.9.2 with cordova (no error and screen orientation is locked)

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

alexs-mbp:bossdesk.mobile2 alexryltsov$ ionic info

Ionic:

   ionic (Ionic CLI)             : 4.5.0 (/Users/alexryltsov/.nvm/versions/node/v10.14.2/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.17
   @angular-devkit/build-angular : 0.10.7
   @angular-devkit/schematics    : 7.0.7
   @angular/cli                  : 7.0.7
   @ionic/angular-toolkit        : 1.2.0

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.11
   @capacitor/core           : 1.0.0-beta.11

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (1 plugins total)

System:

   Android SDK Tools : 26.1.1 (/Users/alexryltsov/Library/Android/sdk/)
   NodeJS            : v10.14.2 (/Users/alexryltsov/.nvm/versions/node/v10.14.2/bin/node)
   npm               : 6.5.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.1 Build version 10B61

alexs-mbp:bossdesk.mobile2 alexryltsov$
@ryaa
Copy link
Contributor Author

ryaa commented Dec 19, 2018

It seems that inside CDVOrientation.m one of the methods returns an error "Error calling to set supported orientations"

@ryaa
Copy link
Contributor Author

ryaa commented Dec 24, 2018

When will this fix be available?

@jcesarmobile
Copy link
Member

Should be on beta 12, was released on Friday

@xtrasmal
Copy link

I am having this issue as well. Is this fixed?

@Kudla161992
Copy link

Kudla161992 commented Mar 11, 2020

I am still having this issue in ionic 4 using capacitor. works perfectly fine in IPhone but not working on IPad. Appreciate your help @mlynch @jcesarmobile

@ryaa
Copy link
Contributor Author

ryaa commented Apr 2, 2020

Just found out that this error is back again event though the screen orientation lock seems to be working

To Native Cordova ->  CDVOrientation screenOrientation INVALID ["options": [3, portrait]]

Here is my current environment

ionic info

Ionic:

   Ionic CLI                     : 6.2.1 (/Users/alexryltsov/.nvm/versions/node/v12.16.1/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.5
   @angular-devkit/build-angular : 0.803.23
   @angular-devkit/schematics    : 8.3.25
   @angular/cli                  : 8.3.25
   @ionic/angular-toolkit        : 2.2.0

Capacitor:

   Capacitor CLI   : 2.0.0-beta.1
   @capacitor/core : 2.0.0-beta.1

Cordova:

   Cordova CLI       : not installed
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (/Users/alexryltsov/Library/Android/sdk/)
   NodeJS            : v12.16.1 (/Users/alexryltsov/.nvm/versions/node/v12.16.1/bin/node)
   npm               : 6.13.4
   OS                : macOS Catalina
   Xcode             : Xcode 11.4 Build version 11E146

@jakobe
Copy link

jakobe commented May 25, 2020

I can confirm @ryaa's comment - I'm also seeing this error now with Capacitor 2.0 (and 2.1).
Even though the screen orientation lock works, the keyboard orientation lock doesn't which results in the following state when rotating:
image

@pentabarf
Copy link

I am also having this issue with Capacitor 2.1 and iOS.
Also in XCode only Portrait and Upside-Down is activated but it is still switching to Landscape.

@jakobe
Copy link

jakobe commented Aug 24, 2020

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants