You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Winston (JIRA)" <ji...@apache.org> on 2015/04/03 20:54:54 UTC

[jira] [Comment Edited] (CB-8047) [WKWebView][iOS8] wkwebview / local webserver plugin orientation issue

    [ https://issues.apache.org/jira/browse/CB-8047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14394911#comment-14394911 ] 

Winston edited comment on CB-8047 at 4/3/15 6:53 PM:
-----------------------------------------------------

We've found a work around to this problem. 

In the generated Cordova MainViewController.m, there is a method that determines what orientations should be permitted. The default implementation is to call your javascript app. I haven't dug into why this fails but I'd suspect with WKWebView, javascript is not yet running. So the default implementation returns NO for all supported orientations. If you override it to return YES, then orientations work fine. See code snippet below.

{code}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    // return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
    return YES; // WKWebView doesn't respond properly yet, so allow all orientations
}
{code}


was (Author: winston):
We've found a work around to this problem. 

In the generated Cordova MainViewController.m, there is a method that determines what orientations should be permitted. The default implementation is to call your javascript app. I haven't dug into why this fails but I'd suspect with WKWebView, javascript is not yet running. So the default implementation returns NO for all supported orientations. If you override it to return YES, then orientations work fine. See code snippet below.

```
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    // return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
    return YES; // WKWebView doesn't respond properly yet, so allow all orientations
}
```

> [WKWebView][iOS8] wkwebview / local webserver plugin orientation issue
> ----------------------------------------------------------------------
>
>                 Key: CB-8047
>                 URL: https://issues.apache.org/jira/browse/CB-8047
>             Project: Apache Cordova
>          Issue Type: Sub-task
>          Components: iOS
>         Environment: IOS
>            Reporter: Dustin Nielson
>            Assignee: Shazron Abdullah
>
> After installing the `wkwebview-engine` plugin on ios device (tested iPhone 6, iPad mini 2, iPad retina) and enabling all orientations in xcode.  Upon successful build the devices have fixed portrait orientation that doesn't change when device is rotated.
> The `wkwebview` branch of cordova-ios was used. This problem does not occur in the `master` branch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org