0

我正在使用 PhoneGap 框架开发黑莓应用程序。我已经使用下面的链接执行了示例应用程序

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

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

在此处输入图像描述

我也尝试了以下步骤 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

配置文件

<?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>
4

1 回答 1

-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-c​​an-be /ta-p/624712

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

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

于 2012-06-12T22:01:00.523 回答