Tizen TV 上的 XmlHttpRequest 退出应用程序

XmlHttpRequest on Tizen TV exits application

我目前正在为三星 Tizen 和 WebOS 电视开发应用程序。 为此,我将三星的 TOAST 和 Caph 与 angular1 一起使用。

生成的 .wgt 在浏览器和电视模拟器上运行良好,但在真实设备上,应用程序在发送 XMLHttpRequest 时退出。

代码如下:

    var url = "grant_type=password&username=" + $scope.logInfos.loginEmail + "&password=" + $scope.logInfos.loginPassword;
    var xhr = new XMLHttpRequest();
    xhr.open('POST', 'https://myUrl/token');
    xhr.onreadystatechange = function() {
        xhr.onloadend = function() {
            if (xhr.response) {
                console.log("logged in");
            }
        };
    };
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xhr.send(url);

这些行在提交登录表单时启动,但此时应用程序退出。控制台中没有错误消息,网络选项卡中也没有 xhr 的踪迹。

我尝试将 HTTPS 更改为 HTTP,以防这是问题所在,但它什么也没做。

你能帮忙吗?

经过搜索,TOAST 似乎删除了以下行:

    <access origin='*' subdomains='true'/>

要使我的应用程序正常工作,我所要做的就是再次将此行添加到 config.xml 文件中。 问题已解决!

不要忘记在您的 config.xml

中添加权限并允许域
<access origin="*" subdomains="true"></access>
<tizen:privilege name="http://tizen.org/privilege/internet"/>