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

On iOS with version 6.0.0-beta.25 example is not working #1852

Closed
2 tasks done
JobiJoba opened this issue Oct 30, 2023 · 20 comments
Closed
2 tasks done

On iOS with version 6.0.0-beta.25 example is not working #1852

JobiJoba opened this issue Oct 30, 2023 · 20 comments
Labels
bug Something isn't working

Comments

@JobiJoba
Copy link

JobiJoba commented Oct 30, 2023

  • I have read the Getting Started section
  • I have already searched for the same problem

Environment

Technology Version
Flutter version 3.17
Plugin version 6.0.0-beta.25
Android version
iOS version 17
macOS version
Xcode version 15

Device information:
Simulator

Description

The example for the InAppWebview at this url https://inappwebview.dev/docs/webview/in-app-webview
doesn't load the url on iOS.

The version 5.8 of the package with the example works well.

Expected behavior:
url load in the webview (have a white screen and strange log see under)

Current behavior:
Url doesn't load

Steps to reproduce

The example from the documentation 6.x.x at this url https://inappwebview.dev/docs/webview/in-app-webview
I didn't change anything

images

image

Stacktrace/Logca

[InAppWebViewController] (iOS) WebView ID 0 calling "shouldOverrideUrlLoading" using {isRedirect: null, hasGesture: null, shouldPerformDownload: false, isForMainFrame: true, request: {allowsExpensiveNetworkAccess: true, body: null, httpShouldHandleCookies: true, cachePolicy: 0, httpShouldUsePipelining: false, assumesHTTP3Capable: false, method: GET, networkServiceType: 0, headers: {User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8}, allowsConstrainedNetworkAccess: true, timeoutInterval: 60.0, mainDocumentURL: https://inappwebview.dev/, url: https://inappwebview.dev/, attribution: 0, allowsCellularAccess: true}, targetFrame: {request: {networkServiceType: 0, url: , allowsCellularAccess: true, mainDocumentURL: null, assumesHTTP3Capable: false, timeoutInterval: 2147483647.0, allowsExpensiveNetworkAccess: true, method: GET, allowsConstrainedNetworkAccess: true, httpShou...
[InAppWebViewController] (iOS) WebView ID 0 calling "onProgressChanged" using {progress: 0}
[InAppWebViewController] (iOS) WebView ID 0 calling "onZoomScaleChanged" using {newScale: 0.43884891271591187, oldScale: 1.0}
[InAppWebViewController] (iOS) WebView ID 0 calling "onContentSizeChanged" using {oldContentSize: {width: 0.0, height: 0.0}, newContentSize: {width: 430.0, height: 671.0}}
[InAppWebViewController] (iOS) WebView ID 0 calling "onContentSizeChanged" using {newContentSize: {height: 671.0, width: 430.0}, oldContentSize: {width: 980.0, height: 1529.0}}
[InAppWebViewController] (iOS) WebView ID 0 calling "onReceivedServerTrustAuthRequest" using {protectionSpace: {receivesCredentialSecurely: true, sslError: {code: 4, message: Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.}, distinguishedNames: null, sslCertificate: {x509Certificate: [48, 130, 5, 3, 48, 130, 3, 235, 160, 3, 2, 1, 2, 2, 18, 3, 228, 89, 68, 224, 173, 58, 100, 220, 218, 134, 227, 36, 119, 254, 60, 69, 131, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 50, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 22, 48, 20, 6, 3, 85, 4, 10, 19, 13, 76, 101, 116, 39, 115, 32, 69, 110, 99, 114, 121, 112, 116, 49, 11, 48, 9, 6, 3, 85, 4, 3, 19, 2, 82, 51, 48, 30, 23, 13, 50, 51, 48, 57, 51, 48, 48, 50, 52, 54, 51, 48, 90, 23, 13, 50, 51, 49, 50, 50, 57, 48, 50, 52, 54, 50, 57, 90, 48, 27, 49, 25, 48, 23, 6, 3, 85, 4, 3, 19, 16, 105, 110, 97, 112, 112, 119, 101, 98, 118, 105, 101, 119, 46, 100, 101, 118, 48, 130, 1, 34...
@JobiJoba JobiJoba added the bug Something isn't working label Oct 30, 2023
@github-actions
Copy link

👋 @JobiJoba

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@makinghappen
Copy link

yes, example is outdated, although it is not hard to modify it to match the current version

@JobiJoba
Copy link
Author

What do you think it need to be updated and make it working?
I did a strict minimal example and it's not working - This code is working on Android without any issues

class _MyAppState extends State<MyApp> {
  final GlobalKey webViewKey = GlobalKey();

  InAppWebViewController? webViewController;
  InAppWebViewSettings settings = InAppWebViewSettings(
      useShouldOverrideUrlLoading: true,
      mediaPlaybackRequiresUserGesture: false,
      allowsInlineMediaPlayback: true,
      iframeAllow: "camera; microphone",
      iframeAllowFullscreen: true);

  String url = "";
  double progress = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text("Official InAppWebView website")),
        body: SafeArea(
            child: Column(children: <Widget>[
          Expanded(
            child: Stack(
              children: [
                InAppWebView(
                  key: webViewKey,
                  initialUrlRequest:
                      URLRequest(url: WebUri("https://inappwebview.dev/")),
                  initialSettings: settings,
                  onWebViewCreated: (controller) {
                    webViewController = controller;
                  },
                  onPermissionRequest: (controller, request) async {
                    return PermissionResponse(
                        resources: request.resources,
                        action: PermissionResponseAction.GRANT);
                  },
                  onReceivedError: (controller, request, error) {
                    print("error");
                  },
                  onProgressChanged: (controller, progress) {
                    setState(() {
                      this.progress = progress / 100;
                    });
                  },
                  onConsoleMessage: (controller, consoleMessage) {
                    print(consoleMessage);
                  },
                ),
                progress < 1.0
                    ? LinearProgressIndicator(value: progress)
                    : Container(),
              ],
            ),
          ),
          ButtonBar(
            alignment: MainAxisAlignment.center,
            children: <Widget>[
              ElevatedButton(
                child: Icon(Icons.arrow_back),
                onPressed: () {
                  webViewController?.goBack();
                },
              ),
              ElevatedButton(
                child: Icon(Icons.arrow_forward),
                onPressed: () {
                  webViewController?.goForward();
                },
              ),
              ElevatedButton(
                child: Icon(Icons.refresh),
                onPressed: () {
                  webViewController?.reload();
                },
              ),
            ],
          ),
        ])));
  }
}

@JobiJoba
Copy link
Author

Hi, When I saw the new version I try again with this simple example but it's still not working on iOS (Simulator) - Where the version 5.8.0 is working.

Any idea?

@Kurokirisu
Copy link

This is still an issue. Version 5.8 works fine, but as soon as I migrate to version 6.0, iOS stops working. It just shows a blank screen. Android works fine.

@ciripel
Copy link

ciripel commented Feb 14, 2024

I also have same issue on version 6.0.0

@mashoodpv
Copy link

i am also having same issue with 6.0.0, works with 5.8.0. Hope to get fixed soon..

@serjsv87
Copy link

I also have this problem. very much waiting forward to it as very well developed rights to camera and microphone with webrts and on android everything works well but on ios it does not load (((

@aquinoartur
Copy link

aquinoartur commented Mar 26, 2024

in my case, the initial url was without an "https" scheme, when added it worked fine again

I had already tested versions 5.7.2+3, 5.8.0 and 6.0.0 and the problem persisted in both, but when I added https everything was fine

@serjsv87
Copy link

serjsv87 commented Apr 1, 2024

It doesn't work in my case, maybe the problem is in the simulator or the processor (M2).
still not working, maybe someone has a solution?

i try in stable version 6.0.0.

@EArminjon
Copy link
Contributor

(I got the issue, i rebooted my MacOS and then it was working again as expected... Weird)

@hasankarli
Copy link

hasankarli commented May 11, 2024

If you are missing this Info.plist file for non https urls or caching, stream audio sources

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

When change your info.plist data, you need to restart phone or simulator. I don't know why clearly. But its works for me.

@tashfeenzaidi
Copy link

tashfeenzaidi commented Jun 11, 2024

I'm also getting the same issue on package version 6.0.0 and on iOS version 17.5, it shows strange behavior. it opens the URL when I click the link button a second time. On the first attempt, it say
sslError: {message: Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified., code: 4}
and a blank screen appears.

@Sumit258000
Copy link

Are there any updates on this? I am facing the same issue working perfectly in android, but on iOS it shows an empty page. @pichillilorenzo

@trungnn-1883
Copy link

@pichillilorenzo
Are there any updates on this? I am facing the same issue working perfectly in android, but on iOS it shows an empty page.

@andrewiankidd
Copy link

The solution posted by @ddty2 in this thread worked for me:
#2013 (comment)

InAppWebView(
  initialSettings: InAppWebViewSettings(
    useHybridComposition: true,
    javaScriptEnabled: true,
    useShouldOverrideUrlLoading: true,
  ),
  shouldOverrideUrlLoading: (controller, action) async {
    return NavigationActionPolicy.ALLOW;
  },
)

@baophan96-tnm
Copy link

I also have same issue on version 6.1.0

@pichillilorenzo
Copy link
Owner

If you set useShouldOverrideUrlLoading: true and then you don’t implement the shouldOverrideUrlLoading event, then it doesn’t make any sense. The default behaviour will block the request.

So, you should remove useShouldOverrideUrlLoading completely from the WebView settings if you are not using the shouldOverrideUrlLoading event.

@Alex-esc1
Copy link

I also have same issue on version 6.1.3
It’s strange that it works on iOS 18, but in versions below the white screen nothing loads

Copy link

github-actions bot commented Nov 5, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests