Skip to content

iOS blocking script on webview_flutter #81254

@Enzodtz

Description

@Enzodtz

Steps to Reproduce

I was using the webview_flutter package, and when openning a specific page on release mode, it didn't work as expected. It probably take so much steps to reproduce it, so maybe it would be better just to show the code in here.

I hope this helps, if not I can provide more code too.

HTML

<script type="text/javascript" src="https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js"></script>

Flutter

// a simple code to load the html in a webview
// mostly like a pseudo code

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebviewScreen extends StatefulWidget {
  @override
  WebviewScreenState createState() {
    return WebviewScreenState();
  }
}

class WebviewScreenState extends State<WebviewScreenState> {
  WebViewController _controller;
  String html = '<HTML from above>';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: WebView(
        initialUrl: 'about:blank',
        onWebViewCreated: (WebViewController webViewController) {
          _controller = webViewController;
          _controller.loadUrl(Uri.dataFromString(
              html,
              mimeType: 'text/html',
              encoding: Encoding.getByName('utf-8')
          ).toString());
        },
      ),
    );
  }
}

Expected results:

So, obviously this is just a fraction of my code. Actually, this script is sort of a lib of a payment gateway that i need to use in my application. It adds some functions that you have to use in order to use the gateway, and also monitor your section with some iframes on it.

Seems pretty simple, and works perfectly... until I deployed into apple. On google play, it worked fine too, and even on apple's simulator. But when I tested it after the deployment, via dowloading by the apple store (release mode), it just got some really unexpected behaviours.

Actual results:

As I said, this is just part of the script, and adds some functions to the code. It seems that the script is not loading, and these functions don't work, breaking my app.

I thought that this could be due to some missing configurations on Info.plist, or anything else from apple's bureaucracy, but I couldn't find nothing related on the docs.

Logs
As I said, this only happens after deploy so I can't get the logs.
This just show unused imports
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [versão 10.0.19041.928], locale pt-BR)
    • Flutter version 1.22.6 at C:\flutter
    • Framework revision 9b2d32b605 (3 months ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5


[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\enzod\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[!] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.55.2)
    • VS Code at C:\Users\enzod\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.21.0

[√] Connected device (1 available)
    • SM G975F (mobile) • 192.168.0.9:5555 • android-arm64 • Android 10 (API 29)

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions