0

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

CleverTap Cordova 插件

对于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();
4

1 回答 1

0

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

为您的应用设置推送通知

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

设置深层链接

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

CleverTap.registerPush();

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

于 2017-08-08T05:15:36.277 回答