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


#1

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$

#2

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