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 摘要。