iOS 在同一 deviceToken 中向特定用户推送通知
我正在使用 Urban Airship 来测试推送通知,效果很好。
我的问题是如何指定哪个用户接收通知而不仅仅是设备令牌。
我的意思是,在某些情况下,一台设备有多个用户,因此许多用户向服务器注册了相同的设备令牌。
或者我是否必须在设备(客户端)本身上进行过滤?
I am using Urban Airship to test push notification and it went well.
My problem is how do I specify which user to get the notification not just the device token.
I mean in some situations where one device has multiple users, so many users registered the same device token to server.
Or do I have to do the filter on the device (client side) itself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,没有真正的方法可以做你想做的事。在 APNS 中只有设备这样的东西。您按下设备,它会在该设备上显示消息/徽章/声音。
如果您的应用程序可以有多个与之关联的用户,那么您需要从推送中找出它与哪个用户相关并进行相应的处理。如何执行此操作取决于您的应用程序,但您可以在推送中添加自定义密钥,以指示其针对的用户。
如果您的应用程序一次只有一个用户登录,那么我建议当您将推送令牌交给服务器时,服务器首先关闭该令牌最初注册的用户的推送,然后为新注册的用户打开推送用户。
There's no real way to do what you want unfortunately. In APNS there's only such thing as a device. You push a device and it shows a message / badge / sound on that device.
If your app can have multiple users associated with it then you'd need to work out from the push which user it relates to and handle it accordingly. How you do that would depend on your app but you could add in a custom key to the push which indicated the user it's for.
If your app only ever has one user logged in at once then I suggest that when you hand the push token to your server, the server first turns off push for the user that the token was originally registered for and subsequently turns push on for the new user.