推送通知令牌在单个设备的所有应用程序中是否唯一?
我将在应用商店上拥有多个应用程序和 1 个城市飞艇帐户,用于向所有这些设备发送推送通知。我想知道的是,每个 Apple 设备是否在所有应用程序中都具有相同的“推送令牌”?这更多的是一种数据库架构问题,因此,如果一台设备使用我的许多应用程序,我就不会多次重复推送令牌。
如果每个 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.
If each Apple device generates a unique push token for each application it has installed my architecture needs to change.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
每个设备的设备令牌并不完全是唯一的;它们对于每个操作系统安装都是唯一的。因此,如果用户购买新设备但不从备份恢复,那么他们将获得新的设备令牌。如果设备被擦除,它将获得新的设备令牌,因此新用户不会收到旧用户的消息。
此外,使用沙箱的开发应用程序和使用生产系统的分发应用程序会返回不同的令牌。
由于单个用户可能将您的应用程序合法地安装在多个设备上(例如 iPhone 和 iPad),因此为了安全起见,在用户和设备令牌之间建立多对多关系会更安全。
既然您提到了城市飞艇,您可能会发现我们的别名功能有助于解决此类问题;您可以为我们的不同令牌分配一个非唯一的别名,然后我们将跟踪您的用户与其设备令牌之间的映射。请参阅UA 文档的注册和推送部分。
编辑:更新,因为我看到这个旧答案有更多的赞成票。从 iOS 7 开始,每个应用程序的设备令牌都是唯一的,即使在同一设备上也是如此。
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.
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.
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.
Edit: 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.
根据苹果最新文档:
According to apple latest doc: