Flutter Insecure http is not allowed by platform

Flutter Insecure http is not allowed by platform,第1张

Flutter Insecure http is not allowed by platform

Flutter 团队最近进行了此更改,现在不允许不安全的 http 连接。 https://flutter.dev/docs/release/break-changes/network-policy-ios-android

我想知道如何将我的手机上的 Flutter 应用程序连接到我的 PC 上运行的本地 Go 服务器。

我的服务器正在运行:http : //192.168.29.45 : 4001但它没有连接到它。

通常需要(并且最好)使用 https 链接而不是 http 链接。但是,这可以被覆盖,如下所示。

安卓

打开android/app/src/main文件夹中的AndroidManifest.xml文件。然后设置为。
usesCleartextTraffictrue


IOS

打开ios/Runner文件夹中的Info.plist文件。然后添加以下键。

NSAppTransportSecurity

NSAllowsArbitraryLoads
  

苹果系统

这与iOS相同。打开macos/Runner文件夹中的Info.plist文件。然后添加以下键。

NSAppTransportSecurity

NSAllowsArbitraryLoads
  

完成这几步然后关闭这个应用程序并运行:

flutter clean
flutter pub get
flutter run

博客来源:雨夜的博客

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/996962.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存