Clevertap for IONIC推送通知不适用于IOS

时间:2017-08-07 14:25:53

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

我使用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();

1 个答案:

答案 0 :(得分:0)

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

Setting Up Push Notifications for your app

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

Setting up deep links

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

CleverTap.registerPush();

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