【问题标题】:Browser is not working in my Blackberry Simulator浏览器无法在我的黑莓模拟器中运行
【发布时间】:2012-06-13 14:05:38
【问题描述】:

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

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 OS,PhoneGap,BlackBerry Email and MDS Services Simulators 4.1.2,Simulator:9550,BlackBerry WebWorks SDK 2.3.1.5

配置.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>

【问题讨论】:

  • 我不明白。为什么要通过 phonegap 访问外部站点?创建 phonegap 的目的是将 本地 html 页面显示为应用程序的 UI,而不是用作浏览器,为此,您可以使用浏览器。
  • 是的,但我的应用程序是基于 Web 服务的。需要实现为黑莓应用程序。在这种情况下,网络应该可以访问服务器!为了检查我的网络是否正常工作,我尝试访问 Google 网站。我也需要帮助。
  • 您是否在黑莓清单文件中设置了适当的权限?
  • 对不起,我不知道..你能解释一下吗!
  • 在您的项目文件之间找到一个名为“config.xml”的文件并将其内容发布到您的问题中。

标签: web-services cordova phonegap-plugins


【解决方案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

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

【讨论】:

  • 抱歉没有运气.. 遇到同样的问题!
  • 他的权限文件,如你所见,已将互联网访问列入白名单:
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多