PhoneGap / Cordova pushplugin iOs注册回调未触发

时间:2015-01-06 21:24:07

标签: ios cordova push-notification phonegap-pushplugin

我正在开发我的第一个PhoneGap / Cordova应用程序,但在iOS推送通知正常工作时遇到了问题。

我的环境如下:

  • Cordova版本:3.5.0-0.2.7
  • 推送插件版本:2.4.0
  • XCode版本:6.1.1

这是代码

var pushNotification = window.plugins.pushNotification;
pushNotification.register(mag.notifications.tokenHandler, mag.notifications.errorHandler, { "badge": "true", "sound": "true", "alert": "true", "ecb": "mag.notifications.onNotificationAPN" });

tokenHandler: function (result) {
    mag.environment.alert("iOS registration successful.");
    mag.notifications.registerId(result);
},

errorHandler: function (error) {
    mag.environment.alert(error);
    console.log(error);
},

onNotificationAPN: function (e) {
    debugger;
    mag.environment.alert("iOS notification received");
},

然而,无论我如何尝试测试或部署(iOS模拟器,在设备上通过xCode,在设备上通过测试飞行),都不会触发任何回调并且不会出现错误。

在Apple开发中心的

我设置了我的应用ID,并为开发和发布启用了推送通知。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

对我来说,事实证明我有#34; Badge App Icon"在iOS通知设置中为我的应用关闭了。转而解决这个问题。

<强>更新

现在我甚至可以转动#34; Badge App Icon&#34;退出并且回调仍在正确触发。即使重新安装应用程序。