简体   繁体   English

推送通知令牌是Mac和iOS独有的吗?

[英]Are Push Notifications tokens unique to Mac & iOS?

By that I mean: If you have an app running on both platform, can you be sure that a given token on iOS isn't attributed to Mac? 我的意思是:如果您在两个平台上都运行了一个应用程序,是否可以确定iOS上的给定令牌不归因于Mac? I'm pretty sure this isn't something we can "know" (Apple internal) and I shouldn't assume it, but I'm really curious what happens if you (by mistake) send an "iOS" Push (intended for your iOS App) to a Mac token. 我很确定这不是我们可以“知道”的东西(Apple内部),我不应该假设,但是我很好奇如果您(错误地)发送“ iOS” Push(打算用于您的iOS应用)添加到Mac令牌。 Could it reach another iOS user?! 它可以联系到另一个iOS用户吗? I guess potentially... 我想可能...

Imagine the following case (simplified): 想象以下情况(简化):

  • You know you have to send a push to the token "foo" to your Mac app. 您知道必须将对令牌“ foo”的推送发送到Mac应用。
  • You mistakenly send a push to "foo" on your iOS app. 您在iOS应用中错误地发送了对“ foo”的推送。
  • I hope it would land in void land / you'd get an error back from APNS but I guess it might also land on a "random" user of your iOS app, which is not the user intended (on the Mac app) 我希望它会降落在空白的土地上/您会从APNS收到错误消息,但我想它也可能落在您iOS应用的“随机”用户上,而不是用户想要的(在Mac应用上)

Sending a push notification requires an SSL certificate from Apple that is bound to your iOS or Mac application. 发送推送通知需要Apple绑定到您的iOS或Mac应用程序的SSL证书。 Therefore it can not happen that a notification for an iOS app is sent to a Mac app. 因此,无法将iOS应用程序的通知发送到Mac应用程序。

From the following quote it doesn't seem possible that the same device token will be assigned to both an iOS device and a Mac (or to two iOS devices or to two Macs), since device tokens contain device IDs, and device IDs should be unique (otherwise they wouldn't be very useful IDs). 从下面的引用看来,不可能将相同的设备令牌同时分配给iOS设备和Mac(或分配给两个iOS设备或两个Mac),因为设备令牌包含设备ID,并且设备ID应该为唯一的(否则,它们将不是非常有用的ID)。

Every notification that a provider sends to APNs for delivery to a device must be accompanied by the device token it obtained from an application on that device. 提供者发送给APN以便传递到设备的每个通知都必须随附从该设备上的应用程序获取的设备令牌。 APNs decrypts the token using the token key, thereby ensuring that the notification is valid. APNs使用令牌密钥解密令牌,从而确保通知有效。 It then uses the device ID contained in the device token to determine the destination device for the notification. 然后,它使用设备令牌中包含的设备ID来确定通知的目标设备 ( Source ) 来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM