【发布时间】:2014-11-28 22:11:12
【问题描述】:
我正在使用 $cordovaPush(来自 ngCordova 功能),它使用 PushPlugin 为 iOS 和 Android 制作推送通知功能,我需要在 iOS 上使用 PHP 作为服务器端来实现此功能,目前我选择 pushbots.com 它是很好,但是如何将本地服务器(我放置用于推送消息的 php 文件)与 PushPlugin 配置链接?
这是 app.js 中的基本代码:
angular.module('starter', ['ionic', 'ngCordova', 'starter.controllers', 'starter.services'])
.config(function($compileProvider){
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel|blob):|data:image\//);
})
.run(function($ionicPlatform, $cordovaPush, $http) {
$ionicPlatform.ready(function() {
..
if (window.PushNotification) {
var iOSconfig = { // iOS configuration only
"badge":"true",
"sound":"true",
"alert":"true"
}
$cordovaPush.register(iOSconfig).then(function(result) {
alert(result);
}, function(err) {
alert(err);
});
}
});
})
当我运行应用程序时,我会看到这条消息:
- no valid 'aps-environment' etitlement string found for application
从这条消息中,我了解到我必须设置 apn 服务器以发送通知消息 + 为启用推送通知创建认证(我已经这样做并将其放在 pushbots.com 上),但我不知道如何设置它或者用 PushPlugin 配置链接,我在这个论坛和其他网站上搜索,但我没有找到我需要的。
【问题讨论】:
标签: ios cordova apple-push-notifications ionic-framework