我正在开发我的第一个 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,并为开发和分发启用了推送通知。
任何帮助将不胜感激。