iOS中的远程通知和静默通知有什么区别? [英] What is difference between remote notification and silent notification in iOS?

查看:1066
本文介绍了iOS中的远程通知和静默通知有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我阅读 Apple Docs 时,他们提到了3种类型的通知:本地,远程和静默。

When I read Apple Docs, they mention 3 types of notification: local, remote, and silent.

可以从应用程序本地发送的名称推断出本地通知。

Local notification can be inferred from its name, that is sent by the app locally.

然而,其他两种类型的区别是什么?

However, what is the difference of 2 other types?

非常感谢。

推荐答案

需要设置太多设置才能使其正常工作。我会尝试剖析它们,让它更容易理解。

There are too many settings that need to be set right for it to work. I'll try to dissect them and make it easier to understand.

总的来说,有几件事情很重要。

Overall several things are important.


  • 无声用户通知之间的总体差异

  • 不同类型的用户 notifications

  • 如何从服务器配置远程通知,即有效负载

  • 如何启用推送通知和来自项目后台模式的远程通知

  • 如何为远程无声通知注册令牌

  • 如何申请用户通知权限

  • 设备启用后台应用刷新和通知

  • 什么是 content-available

  • 了解iOS是上游到您的应用程序

  • 当操作系统收到通知时会发生什么应用程序被用户终止的时间。

  • 关于可靠性和APN架构的说明

  • the overall difference between a silent and user notification
  • different types of user notifications
  • how a remote notification ie the payload is configured from your server
  • how to enable push notifications and Remote notifications from background modes on your project
  • how to register your token for remote and silent notifications
  • how to request permission for user noticications
  • enabling 'background app refresh' and 'notifications' from the device
  • what is content-available
  • understanding that the iOS is upstream to your app when it comes to receiving a remote notification
  • what happens when the OS receives notifications when the app has been user-terminated.
  • A note on reliability and APNs architecture

我强烈建议大家观看前7分钟: WWDC 2015:通知中的新功能。从那里,演示者提到有两种主要类型的通知:

I highly recommend everyone to watch the first 7 minutes of: WWDC 2015: What's new in Notifications. From there the presenter mentions that there are 2 major types of notifications:

它们发生在背景,因此你永远不会看到任何警报/徽章/声音。事情得到下载没有你知道他们。

They happen in the background, hence you never see any alert/badge/sound. Things get downloaded without you knowing about them.


iOS11错误

参见此处
iOS 11初始版本对于静默通知来说是错误的。确保
你有最新的测试版本,否则它可能不是
工作

See here. iOS 11 initial releases were buggy for silent notifications. Make sure you have the latest version for your testing, otherwise it may not work






用户通知



正如名称所说,它与用户有关。也就是说,用户将看到警报/徽章或听到声音。它有两种类型。


User Notifications

As the name says it has something to do with the user. That is the user will see an alert/badge or hear a sound. It has 2 types.

本地通知

本地通知可以触发 3种不同的方式:

A Local Notification can be triggered 3 different ways:


  • UNLocationNotificationTrigger
    当您靠近沃尔玛商店时,您会看到提醒。

  • UNLocationNotificationTrigger: You see an alert when you're close to a Walmart store.

UNTimeIntervalNotificationTrigger :例如:您每10分钟会看到一次提醒。

UNTimeIntervalNotificationTrigger: e.g. You see an alert every 10 minutes.

UNCalendarNotificationTrigger 如同2017年12月1日下午1:00。

UNCalendarNotificationTrigger like December 1st 1:00PM 2017.

远程通知

他们类似于localNotifications,但它们是从服务器触发的,例如一个Whatsapp消息,有一个From字段(妈妈)和一个身体字段(我爱你!)。

They are similar to localNotifications but they are triggered from the server e.g. a Whatsapp message that has a From field (Mom) and a body field (I love you!).

一些随机记录:

要接收静音或远程通知,您需要使用以下方式注册令牌:

To receive a silent or remote notification you need to register for a token using:

application.registerForRemoteNotifications() 

这篇关于iOS中的远程通知和静默通知有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆