Using WebviewScaffold to load URLs doesn't work in iOS

未关闭
#969 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
flutter, ios
领域
mobile

调研方向

首先通过 WebviewScaffold 入口复现 iOS 行为,将其与 FlutterWebViewPlugin.launch() 进行比较,并检查文档中说明的 Info.plist NSAppTransportSecurity 配置。该 issue 未指定源文件或测试,因此首先定位 iOS WebView 实现,并建立一个可复现的 URL 和失败案例;完成的标准是 URL 能够通过 WebviewScaffold 在 iOS 上渲染,同时不导致 Android 行为回归。

由索引模型根据 Issue 内容生成。

描述

System info

Issue occurs on: iOS
Plugin version: 0.4.0
Flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.2, on macOS 14.1.2 23B92 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!

Steps to Reproduce

  1. I am using the WebViewScaffold to launch a URL. This approach works fine on Android and the page is loaded. However, on iOS, it gives a white blank screen.
  2. Followed all the steps mentioned in the documentation and the key "NSAppTransportSecurity" is added to the Info.plist file as recommended in the documentation.
  3. The iOS app launches the URL and works fine if we use an instance of the FlutterWebViewPlugin to call the "launch()" method instead of the WebViewScaffold implementation.
  4. There are no errors logged on the console while running it.
  5. Here is the code that renders the view inside a StatefulWidget
...
return SafeArea(
      child: WebviewScaffold(
        url: _url,
        mediaPlaybackRequiresUserGesture: false,
        useWideViewPort: true,
        appCacheEnabled: true,
        geolocationEnabled: true,
        invalidUrlRegex:
     r'^(https:\/\/api\.whatsapp\.com|https:\/\/apps\.apple\.com|https:\/\/play\.google\.com|tel:|mailto:|https:\/\/www\.facebook\.com|https:\/\/www\.youtube\.com|https:\/\/www\.instagram\.com)',
        debuggingEnabled: true,
      ),
    );

Logs

主要语言
Java
星标
1.5k
派生
933
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fluttercommunity/flutter_webview_plugin 的其他 Issue

查看 fluttercommunity/flutter_webview_plugin 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。