【问题标题】:How to configure apn server in PushPlugin?如何在 PushPlugin 中配置 apn 服务器?
【发布时间】: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


    【解决方案1】:
    1. 检查您的应用是否启用了推送通知。 (Apple 开发者 -> 会员中心 -> 证书、标识符和配置文件 -> 标识符 -> 应用 ID)

    2. 如果您的应用未设置为接收推送通知,请更新您的配置文件

    3. 供应配置文件不能是通配符配置文件。

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-01
      • 1970-01-01
      • 2014-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-20
      相关资源
      最近更新 更多