Flutter WebView HTTP URL在IOS中不起作用

我在flutter中从事webview的工作。我无法在IOS中打开http网址。它在https上工作。谁能建议如何克服这个问题。

我放入了info.plist

 <key>io.flutter.embedded_views_preview</key>
    <string>YES</string>
     <key>NSAllowsArbitraryLoads</key>
    <true/>

关于, 沙沙语

caoxh1975 回答:Flutter WebView HTTP URL在IOS中不起作用

  

在iOS中,UIWebview已过时,因此您应该使用WKWebview。

对于Flutter,您应该使用以下依赖项:

webview_flutter: 0.3.15+1

导入此类:

import 'package:webview_flutter/webview_flutter.dart';

添加此小部件:

@override
Widget build(BuildContext context) {
return Scaffold(
  appBar: new AppBar(
      title: Text(this.title,centerTitle: true
  ),body: WebView(
  initialUrl: url,onPageFinished:(value){
    setState(() {
      print("====your page is load");
    });
  },)
);
}
,

需要禁用Apple Transport Security。

  1. 在Xcode中打开项目。
  2. 打开Info.plist
  3. Information Property List添加新行(检查ID是否已存在)

enter image description here

  1. 选择App Transport Security Settings
  2. 确保将Allow Arbitrary Loads设置为YES
,

将此添加到您的Info.plist

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSAllowsArbitraryLoadsInWebContent</key>
        <true/>
    </dict>
本文链接:https://www.f2er.com/3169290.html

大家都在问