iOS / iPhone : Virtual keyboard not showing on landscape mode

Hello everyone !

This is my first post here, so I hope I’m not doing anything wrong :slight_smile:

After searching here and there, I couldn’t find anything close enought to my issue. So i’m posting it here. I would like to know if some of you had to deal with the following issue :

On iPhone (iOS 12+), while on landscape mode, when hitting on a TextField input or a StageText, the keyboard is not showing at all.

Thing is, we DO NOT have that problem if we put the app on portrait mode, or on iPad (portrait or landscape), which is quite weird.

I also notice that in landscape on iPhone, the statusbar is hidden, like it would be if the app was set to be on fullscreen mode (which is not the case in our code).

We tested that on iPhone 7 (iOS 12 and 13), iPhone XS max (iOS 13) and iPad mini 2 (iOS 12).

We are using the AIR SDK 33.1.1.98 + Flex SDK 4.6.0 on Windows 10, using FlashDevelop (for coding and compiling) + Adobe Animate (to make a UI.swc library only).

Here is our application.xml description for our app
(yes I know there’s some useless stuff that we could get rid of :smile:)

<?xml version="1.0" encoding="utf-8"?>
<application xmlns="http://ns.adobe.com/air/application/33.1">
  <id>com.caprenov</id>
  <versionLabel>5.2.0</versionLabel>
  <versionNumber>5.2.0</versionNumber>
  <filename>CapRenov</filename>
  <name>CapRenov+</name>
  <initialWindow>
    <title>CapRenov+</title>
    <content>CapRenovMobile.swf</content>
    <systemChrome>standard</systemChrome>
    <transparent>false</transparent>
    <visible>true</visible>
    <minimizable>true</minimizable>
    <maximizable>true</maximizable>
    <resizable>true</resizable>
    <autoOrients>false</autoOrients>
    <aspectRatio>landscape</aspectRatio>
  </initialWindow>
  <icon>
    <image40x40>icons/iOS40.png</image40x40>
    <image58x58>icons/iOS58.png</image58x58>
    <image76x76>icons/iOS76.png</image76x76>
    <image80x80>icons/iOS80.png</image80x80>
    <image120x120>icons/iOS120.png</image120x120>
    <image152x152>icons/iOS152.png</image152x152>
    <image167x167>icons/iOS167.png</image167x167>
    <image180x180>icons/iOS180.png</image180x180>
    <image1024x1024>icons/iOS1024.png</image1024x1024>
  </icon>
  <iPhone>
    <assetsCar>Assets.car</assetsCar>
    <InfoAdditions>
      <![CDATA[
        <key>UIDeviceFamily</key>
        <array>
          <string>1</string>
          <string>2</string>
        </array>
        <key>NSAppTransportSecurity</key>
        <dict>
          <key>NSAllowsArbitraryLoads</key><true/>
        </dict>
        <key>CFBundleIconName</key>
        <string>AppIcon</string>
        <key>UILaunchStoryboardName</key>
        <string>LaunchScreen</string>
      ]]>
    </InfoAdditions>
    <requestedDisplayResolution>high</requestedDisplayResolution>
  </iPhone>
</application>

We did’nt had that issue ~2 years ago, when we 1st tested our app on iPhone… Any idea ? :sweat_smile:

Hello,

well … your app XML shows

    <autoOrients>false</autoOrients>
    <aspectRatio>landscape</aspectRatio>

from the doc Setting mobile application properties

autoOrients — Specifies whether the stage should automatically change orientation as the user rotates the device or performs another orientation-related gesture such as opening or closing a sliding keyboard. If false , which is the default, then the stage will not change orientation with the device.

and

aspectRatio — Specifies whether the application should initially display in a portrait format (height greater than width), a landscape format (height less than width), or any format (the stage automatically orients to all orientations).


so I would ask if you manage the screen orientation with code ?

see Stage orientation

eg. you should use Getting the current Stage orientation and aspect ratio
when your app is launched to know in which orientation it starts

and use the others Automatic orientation or Manual orientation

to sync the stage orientation to the device orientation

and if any of that seems confusing etc. I would advise to build a simple test app (eg. displaying a rectangle with some arrows/markers to show Top/Bottom/Right/Left)
and test there

off course, on the actual hardware device be sure to check that the “Portrait Orientation Lock” is “Off”, or at the opposite force it “On” to see how your orientation code react to it

Ideally, someone should be able to say you do this and this and that and boom it will work,
but with orientation it is something imho you have to test/experience to really “get it”

Did you have a problem with this in earlier versions of AIR (such as 31) on iOS, or just with 33? I had a similar problem on Android systems in 31 (I think) and so I had to rig up events to raise the virtual keyboard on focus events. Let me know if you have questions about that I can dig up the code to do this. I think raising the virtual keyboard in Android has been fixed in 33 (I vaguely recall) but I am still using 32 so I’m leaving my stuff in.

Hello, sorry not responding earlier, I was on vacation (mostly) :sweat_smile:

Thanks for your answers !

Good news : I figured out the problem !

Here’s the culprit : stage.displayState = StageDisplayState.NORMAL;

If you use that instruction, then the softkeyboard will not be available (on iPhone, on landscape mode).
It’s quite odd I think.
I just deleted that line, and now everything works perfectly fine, on iPhone, iPad and Android. :smile:

Also, this part :

<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>

it’s on purpose, we need our app to work exclusively on landscape. But I tried with <autoOrients>true</autoOrients> and no <aspectRatio> specified.
The results were that the softkeyboard was available on portrait, and not on landscape.

Anyway, thank you both ! :grinning:

EDIT : I don’t know how to tag this as “solved”… :sweat_smile: