【问题标题】:Push sharp Notification with Title and View Close Buttons使用标题和视图关闭按钮推送清晰的通知
【发布时间】:2015-05-05 15:28:43
【问题描述】:

我正在使用 push sharp 来创建远程通知。 但我收到的通知没有标题和查看/关闭按钮。

我使用的代码改编自 Here

这是我创建警报的方式

    AppleNotificationAlert alert = new AppleNotificationAlert();
    alert.ActionLocalizedKey = "View Alert";
    alert.Body = message;
    alert.AddLocalizedArgs(new object[] { "title", "Test Title"});
    pushBroker.QueueNotification(new AppleNotification()    .ForDeviceToken(deviceToken).WithAlert(alert).WithBadge(1).WithSound("sound.caf").WithCustomItem("level", level).WithContentAvailable(1));

我也尝试按如下方式指定警报正文,但它不显示查看/关闭按钮

 pushBroker.QueueNotification(new AppleNotification()    .ForDeviceToken(deviceToken).WithAlert("Alert Body").WithBadge(1).WithSound("sound.caf").WithCustomItem("level", level).WithContentAvailable(1));

【问题讨论】:

    标签: apple-push-notifications pushsharp


    【解决方案1】:

    您的代码是正确的。我只是把它旋转出来,它起作用了!在您的 IOS 设备设置中选择您的应用,然后选择通知,然后将通知类型从横幅更改为警报,您将获得自定义按钮和标题!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多