为什么 webview_flutter 在添加到应用程序(iOS)时不起作用?

Let*_*ate 4 ios flutter flutter-add-to-app flutter-ios webview-flutter

所以我试图在单击按钮时打开一个简单的网络视图。

这是我的 Scaffold 小部件的主体:

body: 
WebView(
    initialUrl: "https://www.google.com/",
    javascriptMode: JavascriptMode.unrestricted,
)
Run Code Online (Sandbox Code Playgroud)

有趣的是,当我独立运行这个 flutter 项目时,它成功地在 iOS 模拟器中打开了 Webview。但是当我将此 flutter 模块集成到现有的 iOS 应用程序中时,它不起作用(显示空白屏幕)。为了添加颤振模块,我遵循了此链接,模块的其他部分工作正常。

我已经在 flutter 模块的 info.plist 中设置了这个:

<key>io.flutter.embedded_views_preview</key>
<true/>
Run Code Online (Sandbox Code Playgroud)

我在文件中添加了以下版本pubspec.yaml

webview_flutter: ^0.3.22+1
Run Code Online (Sandbox Code Playgroud)

joh*_*evv 8

我在使用webview_flutter时也遇到了这个问题。幸运的是, flutter_webview_plugin的 ios 设置似乎有效。我在 xcode 的 Info.list 中使用了这个标签:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>
Run Code Online (Sandbox Code Playgroud)