NativeScript Http发布请求被阻止 [英] NativeScript Http Post Requests Blocked

查看:97
本文介绍了NativeScript Http发布请求被阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过Angular/Nativescript中的https发送发帖请求.我已经尝试将请求发布到我们的api以及公共api,但它们都失败了.实际上,它们不会因为没有显示任何错误而失败,只是根本不会执行.

这些帖子请求可以在Angular Web应用程序中使用,并且可以使用Postman进行工作.似乎是Nativescript或Android权限问题.

解决方案

在针对Android 9或更高版本的应用中,isCleartextTrafficPermitted()方法默认情况下返回false.如果您的应用需要为特定域启用明文,则必须在位于App_Resources目录中的AndroidManifest.xml中的应用标签中将cleartextTrafficPermitted(android:usesCleartextTraffic="true")显式设置为true.

Trying to send a post request via https in Angular/Nativescript. I have tried post requests to our api as well as public apis and they all fail. In fact they don't fail because they don't show any errors, they just don't get executed at all.

These post requests work in the Angular web app, and they work using Postman. It seems to be a problem with Nativescript or Android permission issue.

解决方案

In apps targeting Android 9 or higher, the isCleartextTrafficPermitted() method returns false by default. If your app needs to enable cleartext for specific domains, you must explicitly set cleartextTrafficPermitted (android:usesCleartextTraffic="true") to true in your application tag in the AndroidManifest.xml located in your App_Resources directory

这篇关于NativeScript Http发布请求被阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆