flutter_inappwebview icon indicating copy to clipboard operation
flutter_inappwebview copied to clipboard

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

Open JobiJoba opened this issue 1 year ago • 16 comments

  • [x] I have read the Getting Started section
  • [x] 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 avatar Oct 30 '23 13:10 JobiJoba

👋 @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!

github-actions[bot] avatar Oct 30 '23 13:10 github-actions[bot]

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

makinghappen avatar Oct 30 '23 19:10 makinghappen

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 avatar Oct 31 '23 00:10 JobiJoba

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?

JobiJoba avatar Nov 16 '23 05:11 JobiJoba

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.

Kurokirisu avatar Feb 07 '24 12:02 Kurokirisu

I also have same issue on version 6.0.0

ciripel avatar Feb 14 '24 08:02 ciripel

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

mashoodpv avatar Mar 08 '24 06:03 mashoodpv

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 (((

serjsv87 avatar Mar 20 '24 20:03 serjsv87

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

aquinoartur avatar Mar 26 '24 13:03 aquinoartur

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.

serjsv87 avatar Apr 01 '24 12:04 serjsv87

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

EArminjon avatar Apr 17 '24 08:04 EArminjon

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.

hasankarli avatar May 11 '24 12:05 hasankarli

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.

tashfeenzaidi avatar Jun 11 '24 11:06 tashfeenzaidi

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

Sumit258000 avatar Jul 18 '24 13:07 Sumit258000

@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.

trungnn-1883 avatar Jul 24 '24 10:07 trungnn-1883