Flutter: 解决WebView无法打开非SSL页面的问题

这个问题主要源于iOS的安全策略,所以解决这个问题就要从iOS入手。方法如下(感谢作者:https://github.com/flutter/flutter/issues/33464#issuecomment-497055810):

 

For the WebView:

  - ADD this in ios/Runner/Info.plist - allows embedded views like webview_flutter
  <key>io.flutter.embedded_views_preview</key>
  <true/>
  
  - ADD this in ios/Runner/Info.plist - allows unsafe sources like http
  <key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
  </dict>

  - ADD this in pubspec.yaml under dependencies
  webview_flutter: ^0.3.7+1

posted @ 2022-06-27 18:03  GreatK  阅读(277)  评论(0编辑  收藏  举报