0

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

我的环境如下:

  • 科尔多瓦版本: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 在设备上,通过测试飞行在设备上)都不会触发任何回调,也不会出现错误。

在苹果开发中心,我设置了我的应用 ID,并为开发和分发启用了推送通知。

任何帮助将不胜感激。

4

1 回答 1

1

对我来说,事实证明我在 iOS 通知设置中为我的应用程序关闭了“徽章应用程序图标”。打开它可以解决问题。

更新:

现在我什至可以关闭“徽章应用程序图标”,并且回调仍然正确触发。即使在重新安装应用程序之后。

于 2015-01-31T01:12:43.783 回答