2017-08-07 59 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