推送通知令牌在单个设备的所有应用程序中是唯一的吗? [英] Are push notification tokens unique across all apps for a single device?

查看:14
本文介绍了推送通知令牌在单个设备的所有应用程序中是唯一的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在应用商店和 1 个城市飞艇帐户上拥有多个应用程序,以向所有这些设备发送推送通知.我想知道的是,每个 Apple 设备是否在所有应用程序中都具有相同的推送令牌"?这更像是一个数据库架构的事情,所以如果一个设备使用我的许多应用程序,我就不会多次复制推送令牌.

I will have multiple applications on the app store and 1 urban airship account to send push notifications to all of these devices. What I want to know is if each Apple device has the same "push token" across all applications? This is more of a database architecture thing so that I don't duplicate a push token many times if one single device uses many of my apps.

如果每个 Apple 设备为其安装的每个应用程序生成一个唯一的推送令牌,我的架构需要更改.

If each Apple device generates a unique push token for each application it has installed my architecture needs to change.

推荐答案

设备令牌并不是每个设备都是唯一的;它们在每个操作系统安装中都是唯一的.因此,如果用户购买了新设备但没有从备份中恢复,那么他们将获得一个新的设备令牌.如果设备被擦除,它将获得一个新的设备令牌,因此新用户不会收到旧用户的消息.

Device tokens are not exactly unique per device; they're unique per operating system installation. So if a user buys a new device but does not restore from backup, then they'll get a new device token. And if a device is wiped, it will get a new device token, so the new user doesn't get the old user's messages.

此外,使用沙盒的开发应用和使用生产系统的分发应用返回不同的令牌.

In addition, there are different tokens returned for development apps using the sandbox and distribution apps using the production system.

由于单个用户可能将您的应用合法安装在多台设备上(例如 iPhone 和 iPad),为了安全起见,在用户和设备令牌之间建立多对多关系会更安全.

Since a single user might have your app installed on multiple devices legally (iPhone and iPad, for instance), it will be much safer to have a many to many relationship between users and device tokens, to be on the safe side.

既然您提到了 Urban Airship,您可能会发现我们的别名功能对此类事情有所帮助;您可以为我们最后的不同令牌分配一个非唯一别名,然后我们将跟踪您的用户与其设备令牌之间的映射.请参阅UA 文档的注册和推送部分.

And since you mentioned Urban Airship, you might find that our alias feature helps for this sort of thing; you can assign a non-unique alias to the different tokens in our end, and then we'll keep track of the mapping between your users and their device tokens. See the registration and push parts of the UA documentation.

更新,因为我在这个旧答案上看到了更多的赞成票.从 iOS 7 开始,设备令牌对于每个应用程序都是唯一的,即使在同一设备上也是如此.

An update because I saw some more upvotes on this old answer. As of iOS 7, device tokens are unique for each application, even on the same device.

这篇关于推送通知令牌在单个设备的所有应用程序中是唯一的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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