2017-08-07 86 views
0

我已经使用IONIC 1构建了一个应用程序,并使用clevertap进行分析和推送通知。我使用的是官方科尔多瓦插件消耗CLEVERTAP推送通知,Clevertap for IONIC推送通知不适用于IOS

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(); 

回答

0

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

Setting Up Push Notifications for your app

如果您计划使用深层链接,请检查以下链接 -

Setting up deep links

然后从您的JavaScript文件,使用下面的代码到的APN令牌推到CleverTap -

CleverTap.registerPush(); 

让我知道,如果这是对你有用。如果您有更多问题或疑问,可以随时联系CleverTap支持团队[email protected]

+0

我已经添加了推送通知初始化的示例代码。让我知道。 – NitinD

+0

您是否也设置了APNs证书? –

+0

是的,我做到了。没有这一点,您无法注册以在Clevertap上推送通知。 – NitinD