Push Woosh and PhoneGap 2.5.0 implimentation
Push Woosh and PhoneGap 2.5.0 implimentation
我已经尝试了各种方法来实现这里的代码:
http://www.pushwoosh.com/programming-push-notification/push-notification-sdk-integration-for-phonegap/和我不及格。我在后台启用了它,我尽我所能地遵循所有这些指示……我的个人资料在应用程序开发人员的portal中启用,但对于我的生活,我失败了....我想我失败了:
function initPushwoosh() {
var pushNotification = window.plugins.pushNotification;
pushNotification.onDeviceReady();
pushNotification.registerDevice({alert:true, badge:true, sound:true, pw_appid:"PUSHWOOSH_APP_ID", appname:"APP_NAME"},
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);
});
}
我确保我把这个放在我的index.js中,我确保我把我的应用代码和应用程序名称匹配pooshwoosh后端门户,但我仍然失败…任何内部将是惊人的!!!!
你在XCode控制台日志中看到了什么?你收到推送通知令牌了吗?另外,在控制面板中是否看到任何订阅者?
首先要检查的是你的mobileprovisioning profile是否启用了push。在其中查找"aps-environment"字符串。还要注意,Pushwoosh控制面板中的网关设置必须与配置文件匹配:"沙盒"用于"开发"配置文件,"生产"用于Ah-Hoc和AppStore构建。
最好从下面的示例项目开始:https://github.com/shaders/push-notifications-sdk/tree/master/SDK%20Sample%20Projects/iPhone-Phonegap