关闭。这个问题需要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。
这是我可以访问的后端:
我已经允许 cors 访问,但即使这对我也没有帮助。
我已经尝试使用 http://localhost:port/path 和 http://myIP:port/path 但没有用!
但是如果我尝试通过浏览器直接访问,那么工作。
最佳答案
对于安卓:
遵循迁移指南可以忽略此行为: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/