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

builds with cordova-ios@6.0.0 are locked in portrait view #899

Closed
eradin opened this issue Jun 13, 2020 · 17 comments
Closed

builds with cordova-ios@6.0.0 are locked in portrait view #899

eradin opened this issue Jun 13, 2020 · 17 comments
Milestone

Comments

@eradin
Copy link

eradin commented Jun 13, 2020

Bug Report

Problem

Build with V6.0.0, splash screen and app will always be in portrait view even when device is in landscape orientation.

What is expected to happen?

Iphone and ipad should reorient app based on orientation.

Environment, Platform, Device

Confirmed on ipad 6th gen, IOS 13

Version information

<plugin name="cordova-plugin-camera" spec="4.1.0" />
<plugin name="cordova-plugin-file" spec="6.0.2" />
<plugin name="cordova-plugin-media" spec="5.0.2" />
<plugin name="cordova-plugin-file-opener2" spec="3.0.0" />
<plugin name="cordova-plugin-inappbrowser" spec="4.0.0" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.4" />
<plugin name="cordova-plugin-keyboard" spec="1.2.0" />
<plugin name="cordova-plugin-statusbar" spec="2.4.3" />
<plugin name="cordova-plugin-whitelist" spec="1.3.4" />
<plugin name="phonegap-plugin-push" spec="2.3.0" />
<plugin name="cordova-plugin-device" spec="2.0.3" />

cordova 9 cli
cordova-ios 6.0.0

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
@timbru31
Copy link
Member

We merged some fixes for splashscrens, can you test the current master and see if the problem is already fixed? You can do so by adding the platform via cordova platform add https://github.com/apache/cordova-ios.git

@antikalk
Copy link

@timbru31 I am currently using the master branch of cordova-ios and experiencing the same issue. (only tested in the ios simulator though)

@kamhawy4
Copy link

same problem when i'm use v 6.0.0 and 6.1.0-dev

@eradin
Copy link
Author

eradin commented Jun 14, 2020

@antikalk, @kamhawy4, On 6.0.0, my splash screen isn't respecting the 3 second default. It appears for about .5 seconds. Are you still seeing that on the mast branch?

@antikalk
Copy link

@eradin There has been a PR merged into the master branch, that fixed the fast disappearing splash screen error. For me using the master branch solved my splash screen problems. Keep in mind using the master branch is not recommended for production.

@mosabab
Copy link

mosabab commented Jun 15, 2020

For iOS you should use the preference for orientation and set value to all like this
<preference name="Orientation" value="all" />

This will set when cordova add the platform and tell the platform for iOS to make all possible orientation for iOS devices.

Please note: In the past, if you don't use the preference orientation with value all or even if you omit this preference, the orientation was set for both landscape and portrait mode (like Android), but recently you should use the preference orientation with value all to see both orientation modes.

@antikalk
Copy link

@mosabab Thank you very much, that works for me 👍

@eradin
Copy link
Author

eradin commented Jun 15, 2020

@mosabab Shouldn't this be the default? It has been on prior versions.

@breautek
Copy link
Contributor

breautek commented Jun 15, 2020

The default is the Xcode default, I believe.

Default: default
Allowed values: default, landscape, portrait
Allows you to lock orientation and prevent the interface from rotating in response to changes in orientation.
NOTE: The default value means Cordova will strip the orientation preference entry from the platform's manifest/configuration file allowing the platform to fallback to its default behavior. For iOS, to specify both portrait & landscape mode you would use the platform specific value 'all'.

https://cordova.apache.org/docs/en/latest/config_ref/index.html

@eradin
Copy link
Author

eradin commented Jun 15, 2020

@breautek That's fine but what if you don't include this directive? From everything I can find online, the ios default has always been "all" (same with android). So are you saying that the default WKWEBVIEW orientation is portrait? If that's the case, then to get "traditional legacy behavior", this directive would be mandatory. This seems odd to me as the behavior is in contrary to all previous views (i.e. UIWEBVIEW) and ios versions.

@breautek
Copy link
Contributor

breautek commented Jun 15, 2020

but what if you don't include this directive?

Then it defaults to default, which is the underlying tool's default setting. Cordova doesn't impose an opinion here.

So are you saying that the default WKWEBVIEW orientation is portrait?

All I'm saying is that Cordova's default is to let Xcode (or Android SDK for android) decide what the default should be and not all, even if default behaviour was all, previously. This means the default behaviour could end up changing if the underlying tools decided to change their defaults.

I don't know if this is the exact reason for the change of behaviour between cordova-ios@5 and cordova-ios@6, or between UIWebView & WKWebView. If I were to make a guess, I would think it's the difference between Xcode versions... but this is something that I think should be investigated to confirm it is indeed a regression.

@eradin
Copy link
Author

eradin commented Jun 15, 2020

Thanks for the clarification. "but this is something that I think should be investigated to confirm it is indeed a regression". Indeed.

@dpogue
Copy link
Member

dpogue commented Jun 15, 2020

I believe #615 is what caused this.

I also believe that using the platform defaults by default is the behaviour that we want, and people should use the Orientation preference to specify behaviour for their apps.

@mosabab
Copy link

mosabab commented Jun 16, 2020

@eradin
Anyway, if you need your project to be as you need, just set the preference orientation value to all or what you need, to keep your project as you want even if the default could be change in the future.

@mosabab
Copy link

mosabab commented Jun 16, 2020

Additional information:

I have another issue like what you mentioned here.

I was put the the preference for statusbarstyle to lightcontent or just i omit this preference (because the default value in doc is lightconent https://github.com/apache/cordova-plugin-statusbar#configxml) , and i see that Xcode always read the statusbar style to dark content (dark text, for light background).

So, I change the statusbar style manually to make light content instead of dark, because this preference <preference name="StatusBarStyle" value="lightcontent" /> is broken and not read by iOS any more.

So to fix this issue i do it manually by JS code like this:

function onDeviceReady() {

StatusBar.styleLightContent();
}

For that reason i open a new issue apache/cordova-plugin-statusbar#192 regarding this problem.

@dpogue
Copy link
Member

dpogue commented Jun 17, 2020

I also believe that using the platform defaults by default is the behaviour that we want

Just double checked what a newly-created iOS project has as defaults in Xcode, and it does specify certain default rotations:

	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>

@dpogue dpogue added this to the 6.1.0 milestone Jun 22, 2020
@dpogue
Copy link
Member

dpogue commented Jun 22, 2020

This will be fixed when 6.1.0 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants