【问题标题】:Clevertap for IONIC push notification not working for IOS用于 IONIC 推送通知的 Clevertap 不适用于 IOS
【发布时间】:2017-08-07 14:25:52
【问题描述】:

我使用 IONIC 1 构建了一个应用程序,并使用clevertap 进行分析和推送通知。我正在使用官方的 cordova 插件来使用 CLEVERTAP 推送通知,

CleverTap Cordova Plugin

对于 android 可以正常工作,但对于 IOS 则无法正常工作。谁能帮我解决这个问题?

这里是示例初始化代码,

var app = {
initialize: function() {
    this.bindEvents();
},
bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
    document.addEventListener('onCleverTapProfileSync', this.onCleverTapProfileSync, false);
    document.addEventListener('onCleverTapProfileDidInitialize', this.onCleverTapProfileDidInitialize, false);
    document.addEventListener('onCleverTapInAppNotificationDismissed', this.onCleverTapInAppNotificationDismissed, false);
    document.addEventListener('onDeepLink', this.onDeepLink, false);
    document.addEventListener('onPushNotification', this.onPushNotification, false);
},
onDeviceReady: function() {
    app.receivedEvent('deviceready');
   $rootScope.CleverTap = CleverTap;
   CleverTap.notifyDeviceReady();
   CleverTap.registerPush();

},
onCleverTapProfileSync: function(e) {
    console.log(e.updates);
},
onCleverTapProfileDidInitialize: function(e) {
    console.log(e.CleverTapID);
},
onCleverTapInAppNotificationDismissed: function(e) {
    console.log(e.extras);
    console.log(e.actionExtras);
},
onDeepLink: function(e) {
    console.log(e.deeplink);
},
onPushNotification: function(e) {
    console.log(JSON.stringify(e.notification));
},
receivedEvent: function(id) {
    var parentElement = document.getElementById(id);
    console.log('parseElement', parentElement, id);
    var listeningElement = parentElement.querySelector('.listening');
    var receivedElement = parentElement.querySelector('.received');

    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');

    console.log('Received Event: ' + id);
}};app.initialize();

【问题讨论】:

    标签: push-notification apple-push-notifications clevertap


    【解决方案1】:

    要为 iOS 设置推送通知,您需要按照以下链接中给出的步骤设置您的 Apple 证书 -

    Setting Up Push Notifications for your app

    如果您打算使用深层链接,请查看以下链接 -

    Setting up deep links

    然后从您的 Javascript 文件中,使用以下代码将 APNs 令牌推送到 CleverTap -

    CleverTap.registerPush();
    

    如果这对您有用,请告诉我。如果您有更多问题或疑虑,您可以随时通过 support@clevertap.com 联系 CleverTap 支持团队

    【讨论】:

    • 我已经添加了推送通知初始化的示例代码。告诉我。
    • 您是否也设置了 APNs 证书?
    • 是的,我做到了。否则,您将无法在 Clevertap 上注册推送通知。
    • @NitinD 您是否将 APNs 证书保存在 CleverTap 仪表板上?
    • 我建议您通过 support@clevertap.com 给我们写信并提及您的帐户 ID,以便我们可以检查仪表板级别的确切情况以及我们如何为您快速解决此问题。感谢您的耐心等待。
    猜你喜欢
    • 2017-01-22
    • 2020-05-22
    • 2018-05-25
    • 1970-01-01
    • 1970-01-01
    • 2012-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多