大家好,这个问题让我发疯,我试图为 phonegap 应用 pushwoosh sdk,但它似乎无法正常工作!我已经从我的配置文件中检查了所有内容,其中包含“aps-envierment”,所有推送证书都已配置。p12 aps开发一切,但设备只是dosnt注册!示例代码到我的 index.html
我在 config.xml 中配置了插件所有带有 .h .m 的 pushwoosh 的插件文件夹都在插件文件夹中,一切都编译好了,只是在运行时没有得到注册提示,如果有人可以提供帮助,那就太好了非常感激。
<script type="text/javascript" charset="utf-8" src="PushNotification.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript">
function initPushwoosh()
{
alert('initing pushwoosh');
var pushNotification = window.plugins.pushNotification;
pushNotification.onDeviceReady();
pushNotification.registerDevice({alert:true, badge:true, sound:true, pw_appid:"*****the right id just hidden", appname:"testingNewPush"},
function(status) {
var deviceToken = status['deviceToken'];
console.warn('registerDevice: ' + deviceToken);
},
function(status) {
console.warn('failed to register : ' + JSON.stringify(status));
//navigator.notification.alert(JSON.stringify(['failed to register ', status]));
});
pushNotification.setApplicationIconBadgeNumber(0);
document.addEventListener('push-notification', function(event) {
var notification = event.notification;
navigator.notification.alert(notification.aps.alert);
pushNotification.setApplicationIconBadgeNumber(0);
});
}
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady(){
alert('device');
initPushwoosh();
app.receivedEvent('deviceready');
}
</script>
<title>Hello World</title>
</head>
<body onload="onBodyLoad()">
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
</body>