我试图在我的BlackBerry Webworks应用程序(HTML5中的BB10)中使用Push Service插件。BlackBerry WebWorks 2.0.0.54的Push Service插件错误(Cordova 3.2)(两个SDK的最新版本)
我像文档说的那样通过命令行添加插件,并检查com.blackberry.push文件夹是否在我的项目中的plugins文件夹中。我跑的应用在我的设备和Web检查了下一个错误:
类型错误:“未定义”不是(评估“window.webworks.defineReadOnlyField”)
出现此错误当一个对象插件试图定义像SUCCESS或INVALID_PPG_SUBSCRIBER_STATE这样的常量,所以显然插件永远不会开始工作,我不能使用推送服务。
我有我的推送凭据很好(他们在我的OS 7应用程序中工作正常),并且当我编写config.xml文件时我非常小心。那就是:
<widget id="Sample"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0" version="0.0.1">
<name>Sample</name>
<license href="http://www.apache.org/licenses/LICENSE-2.0"/>
<author email="[email protected]" href="http://www.something.com">Something</author>
<content src="splash.html"/>
<access uri="http://www.mypushserver.com/Registro_Portalesv4/modules/Register" subdomains="true"></access>
<access origin="*"/>
<preference name="fullscreen" value="true"/>
<preference name="webviewbounce" value="true"/>
<description>Example</description>
<icon src="img/icono.png"/>
<feature id="blackberry.app"/>
<feature id="blackberry.push" />
<feature id="blackberry.system" />
<feature id="blackberry.invoked" />
<feature id="blackberry.ui.dialog" />
<feature id="org.apache.cordova" required="true" version="1.0.0" />
<rim:permissions>*
<rim:permit>access_shared</rim:permit>
<rim:permit>post_notification</rim:permit>
<rim:permit system="true">_sys_use_consumer_push</rim:permit>
<rim:permit>read_device_identifying_information</rim:permit>
<rim:permit>access_pimdomain_messages</rim:permit>
<rim:permit>bbm_connect</rim:permit>
<rim:permit>run_when_backgrounded</rim:permit>
</rim:permissions>
<rim:invoke-target id="example.sample.invoke.push">
<type>APPLICATION</type>
<filter>
<action>bb.action.PUSH</action>
<mime-type>application/vnd.push</mime-type>
</filter>
</rim:invoke-target>
<!-- Have an invoke entry here for when a notification is clicked on in the BlackBerry Hub -->
<!-- This will cause the application to be opened -->
<rim:invoke-target id="example.sample10.invoke.open">
<type>APPLICATION</type>
<filter>
<action>bb.action.OPEN</action>
<mime-type>text/plain</mime-type>
</filter>
</rim:invoke-target>
</widget>
我也注意到的是,该功能“window.webworks.defineReadOnlyField”位于WebWorks的-1.0.4.11.js文件至极我没有包括在我的项目,因为我建议使用cordova.js作为BlackBerry WebWorks Documentation, Upgrading to WebWorks 2.0。所以我认为push插件可能没有针对新的SDK进行更新,或者我也错过了一些东西。
任何想法?先谢谢了!
PS:我从Phonegap Android移植我的应用程序,并且在将它移植到Blackberry时工作得很好,除了插件外,我必须添加并调整它们才能工作(除了插件)。