node.js - 状态错误 : Insecure HTTP is not allowed by platform:

标签 node.js flutter http mobile connection

关闭。这个问题需要debugging details .它目前不接受答案。












想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。

6 个月前关闭。




Improve this question




我有以下问题:
E/flutter (7144): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] 未处理的异常:错误状态:平台不允许不安全的 HTTP:http://myIPv4:PORT/PATH。
This is my flutter code to requisition
这是我可以访问的后端:
My backend code
我已经允许 cors 访问,但即使这对我也没有帮助。
我已经尝试使用 http://localhost:port/path 和 http://myIP:port/path 但没有用!
但是如果我尝试通过浏览器直接访问,那么工作。
Browser Print

最佳答案

对于安卓:
遵循迁移指南可以忽略此行为:https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android .
或...只需添加 android/app/src/main/AndroidManifest.xml: android:usesCleartextTraffic="true"<application />也别忘了拿互联网允许:

<uses-permission android:name="android.permission.INTERNET" /> <!-- This Line -->

<application
        android:name="io.flutter.app.FlutterApplication"
        android:label="receipt"
        android:usesCleartextTraffic="true" <!-- This Line -->
        android:icon="@mipmap/ic_launcher">
对于 iOS:
在 iOS 上的应用程序中全局允许不安全/HTTP 请求,您可以将此添加到您的 ios/Runner/info.plist 在主词典定义下:
<key>NSAppTransportSecurity</key>
<dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
</dict>
请注意,启用此功能时,您需要向 Apple 的审核团队做出解释,否则您的应用程序将在提交时被拒绝。
谢谢你。

关于node.js - 状态错误 : Insecure HTTP is not allowed by platform:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64197752/

相关文章:

flutter - 配置单元registerAdapter不接受ID

node.js - 为什么 Node.js 无法提供 .woff 文件

http - 根据 Angular 2中先前请求的结果执行http请求

Python 请求模块卡在套接字连接上,但 cURL 有效

javascript - 如何以编程方式使 DXF 文件具有交互性?

mysql - 表达 mysql session

flutter - 如何删除此 fl-chart flutter 中的 X-Y 值

node.js - 如何使用 nightmare.js 库混淆 JS 文件

node.js - TypeORM 选择所有行但限制 25

flutter - 如何在抖动中使用来自第三方包装 Assets 的图像?