【问题标题】:How the server know whether the push notification received by iPhone or not?服务器如何知道 iPhone 是否收到推送通知?
【发布时间】:2011-06-16 11:38:43
【问题描述】:
服务器如何知道 iPhone 是否收到推送通知(以及用户执行的操作(点击“取消”或“查看”))。我是否需要从客户端向服务器发送“收到通知”的单独消息,或者是否有任何机制可以通过服务器从 APNS 获取状态,以便我可以避免从客户端发送消息。
我查了enter和Push notification guide,但没有找到任何信息。
【问题讨论】:
标签:
iphone
objective-c
client-server
push-notification
【解决方案1】:
根据文件,不能保证成功接收通知。此外,APNS 不会通知服务器推送通知的成功传递。所以更好
关于方法
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
//you can send a message to the server so that server can make sure that notification is delivered successfully.
}
仅供参考:如果对特定设备令牌的通知不断失败,APNS 将通知这一点。
来自苹果文档
“Apple 推送通知服务包括一项反馈服务,APN 会不断更新每个应用程序的失败交付尝试设备列表。这些设备由以二进制格式编码的设备令牌标识。提供者应定期查询反馈服务以获取其应用程序的设备令牌列表,每个令牌都由其主题标识。然后,在验证应用程序最近没有在标识的设备上重新注册后,提供者应停止向这些设备发送通知设备。”