应用传输安全阻止https发布请求正文数据,尽管它是允许的

时间:2017-11-18 14:27:41

标签: ionic-framework https xamarin.ios app-transport-security

我正在使用离子v1来构建ios应用程序。 每当我发送任何https发布请求时,数据都不会发送,我收到数据为空的错误响应

{
    "data": null,
    "status": -1,
    "config": {
        "method": "POST",
        "transformRequest": [null],
        "transformResponse": [null],
        "dataType": "json",
        "url": "https://Demo.xxxxxxxxx.com/route1/route2",
        "data": {
            "user": "Demo"
        },
        "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": "application/json;charset=utf-8"
        }
    },
    "statusText": ""
}

我正在做的http请求是

$http({
    method: 'POST',
    dataType: 'json',
    url: "https://Demo.xxxxxxxxx.com/route1/route2";,
    data: {
        user: 'demo'
    }
})

我将此添加到我的.list文件

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

0 个答案:

没有答案