ios - 使用无法在 azure 通知中心工作的标签注册推送通知

标签 ios azure cordova push-notification azure-mobile-services

我知道这个问题主要是 tag registration ANH 的重复。但没有具体答案,这就是我再次提出的原因。

我正在开发 Cordova 应用程序并使用此 Azure 移动服务插件 ( https://github.com/Azure/azure-mobile-apps-cordova-client ) 来注册推送通知。我从 PNS(gcm 和 apns)获得成功响应,并且向通知中心注册(注册事件)的调用也返回下面的成功响应。当我使用 Azure 通知中心的“测试发送”实用程序发送通知而不指定标签时,我也会在设备上收到通知(在 IOS 和 Android 上),但当我尝试使用标签发送通知时,不会收到任何通知。还有其他方法可以注册标签吗?

client.push.register('gcm', handle, {
      mytemplate: { body: { data: { message: "{$(messageParam)}" } },
                 tags: [tag}                          
  }).then(function(data){
        alert("success");
    },function(error){
        alert(error);
    });} else if (device.platform === 'iOS') {
  // Register for notifications.            
  client.push.register('apns', handle, {
      mytemplate: { body: { aps: { alert: "{$(messageParam)}" } },
                  tags: [tag]}                           
  }).then(function(data){
        alert("success");
    },function(error){
        alert(error);
    });} 

最佳答案

如果您使用指定的插件,那么您确实有后端代码。标签只能在后端注册 - 不能在前端注册(好吧,除非您在请求中发送标签,然后在后端读取该请求以执行相同的请求 - 但这仍然是后端进行注册)。

此时。我建议不要使用 Azure 移动应用来实现此功能。创建一个为您进行注册的 Azure Function API,然后使用它来注册推送。 Azure 移动应用的 future 版本将不会包含 ANH 功能。

关于ios - 使用无法在 azure 通知中心工作的标签注册推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56785526/

相关文章:

javascript - 当我 “Pull to refresh” 时,我如何清理缓存?使用 Ionic 框架和 AngularJS

ios - 发送到实例 Swift NSNotification 的无法识别的选择器

ios - 控制 UITabBar 项目

ios - 消息显示为空白?

sql - SQL Azure 上的计划任务

javascript - 如何在 Android 上自动打开 GPS?

iphone - 使用 ARC 时声明委托(delegate)

azure - 将数据从 WP8 插入到 Azure 数据库(移动服务)后 MoveNext() 异常

azure - 从本地 Kubernetes 集群访问 Azure 文件共享

javascript - 混合移动应用程序中的谷歌地图缓存图 block