本文介绍了无法通过 Tizen 模拟器中的代理连接到 Internet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 ajax 代码检索 json 数据时,在 tizen 可穿戴模拟器 2.3.1 中,出现无法连接到代理错误.

When i use ajax code to retrieve a json data, in tizen wearable emulator 2.3.1, I'm getting not able to connect to proxy error.

但是当我搜索时,每个人都说不需要给出任何具体的模拟器的代理设置.如果 Internet 在 Tizen ide 中运行良好,那么它将也可以在 Tizen 模拟器中工作.但我收到代理错误.

有人可以帮我解决这个代理错误吗?

Can someone help me solve this proxy error?

更新:

我应该在哪里更改代理?

Where should I change the proxy?

代码示例:

 $.getJSON( "http://api.geonames.org/citiesJSON? north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo", function( data ) {
                  $('#divText').html(data.result);
                })
                .fail(function( err ) {
                    //Never called
                    console.log( err );
                });
        }

推荐答案

config.xml 文件中为您的 Tizen 应用程序添加 Internet 访问权限.Internet 权限允许应用程序访问 Internet.

Add internet access privilege for your Tizen application in the config.xml file.Internet Privilege allows the application to access the Internet.

    <tizen:privilege name="tizen.org/privilege/internet"/>

还可能需要定义外部访问策略才能访问网络.根据 W3C 访问请求策略 (WARP),默认情况下您不能访问外部网络资源.如果您需要访问外部网络资源,则必须使用 config.xml 文件中的策略为 Web 应用程序请求网络资源权限.

Also defining external access Policy may be required to access network. According to the W3C Access Requests Policy (WARP), you cannot access external network resources by default. If you require access to an external network resource, you must request network resource permissions for the Web application using the Policy in the config.xml file.

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

现在您的应用程序应该能够从模拟器以及真实设备访问互联网.

Now your application should be able to access internet from the emulator as well as real devices.

这篇关于无法通过 Tizen 模拟器中的代理连接到 Internet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 16:53