浏览器无法在我的Blackberry Simulator中运行

时间:2012-06-12 13:38:36

标签: web-services cordova phonegap-plugins

我正在使用PhoneGap框架开发Blackberry应用程序。我已使用以下链接

执行了示例应用

http://wiki.phonegap.com/w/page/31930982/Getting%20Started%20with%20PhoneGap%20BlackBerry%20WebWorks

但浏览器无法在我的模拟器中运行。我的意思是,如果我尝试转到Google网站,我会收到以下错误

enter image description here

我也尝试了以下步骤 1)我安装了“BlackBerry Email and MDS Services Simulators 4.1.2” 2)运行MDS并运行我的应用程序

即使我遇到了问题。请指教!

设备详细信息: Windows操作系统,PhoneGap,BlackBerry电子邮件和MDS服务模拟器4.1.2,模拟器:9550,BlackBerry WebWorks SDK 2.3.1.5

的Config.xml

<?xml version="1.0" encoding="UTF-8"?>

<!--
  Widget Configuration Reference:
    http://docs.blackberry.com/en/developers/deliverables/15274/
-->

<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
    version="1.0.0.0">

  <name>Corperate Directory</name>
<access subdomains="false" uri="http://www.google.com"/>


  <description>
      A sample application written with Cordova.
  </description>

  <license href="http://opensource.org/licenses/alphabetical">
  </license>

  <!-- Cordova API -->
  <feature id="blackberry.system" required="true" version="1.0.0.0" />
  <feature id="org.apache.cordova" required="true" version="1.0.0" />
  <feature id="blackberry.find" required="true" version="1.0.0.0" />
  <feature id="blackberry.identity" required="true" version="1.0.0.0" />
  <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
  <feature id="blackberry.pim.Contact" required="true" version="1.0.0.0" />
  <feature id="blackberry.io.file" required="true" version="1.0.0.0" />
  <feature id="blackberry.utils" required="true" version="1.0.0.0" />
  <feature id="blackberry.io.dir" required="true" version="1.0.0.0" />
  <feature id="blackberry.app" required="true" version="1.0.0.0" />
  <feature id="blackberry.app.event" required="true" version="1.0.0.0" />
  <feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
  <feature id="blackberry.widgetcache" required="true" version="1.0.0.0"/>
  <feature id="blackberry.media.camera" />
  <feature id="blackberry.ui.dialog" />

  <!-- Cordova API -->
  <access subdomains="true" uri="file:///store/home" />
  <access subdomains="true" uri="file:///SDCard" />

  <!-- Expose access to all URIs, including the file and http protocols -->
  <access subdomains="true" uri="*" />

  <icon rim:hover="false" src="resources/icon.png" />
  <icon rim:hover="true" src="resources/icon.png" />

  <rim:loadingScreen backgroundColor="#CFCFCF"
                     foregroundImage="resources/loading_foreground.png"
             onFirstLaunch="true">
    <rim:transitionEffect type="fadeOut" />
  </rim:loadingScreen>

  <content src="index.html" />

  <rim:permissions>
    <rim:permit>use_camera</rim:permit>
    <rim:permit>read_device_identifying_information</rim:permit>
    <rim:permit>access_shared</rim:permit>
    <rim:permit>read_geolocation</rim:permit>
  </rim:permissions>

</widget>

1 个答案:

答案 0 :(得分:-1)

您可能需要在config.xml中将google.com列入白名单:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" 
    xmlns:rim="http://www.blackberry.com/ns/widgets" 
    version="1.0.0.0">
<name>commonPitfalls</name>

    <access subdomains="false" uri="http://www.google.com"/>

</widget>

来自:http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Common-BlackBerry-WebWorks-development-pitfalls-that-can-be/ta-p/624712

或者,您可以使用PhoneGap提供的连接API,而不是检查google.com: http://docs.phonegap.com/en/1.8.0/cordova_connection_connection.md.html#Connection

或者使用xhr到google.com(在config.xml中使用相应的白名单)来查看是否以某种方式获得响应,而不是在页面中加载。