本文介绍了卸载应用程序后,apns http2 api 不返回状态 410的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有 http2 协议的 apns 发送推送通知,我使用的代码类似于这篇文章:https://stackoverflow.com/a/34831873/1546652

Im using apns with http2 protocol for sending pushnotifications, the code i use is similar to this post:https://stackoverflow.com/a/34831873/1546652

当我的应用程序正确安装时,apns http2 api 在发送消息时工作正常,我的响应是某种风格:{"response":"","httpcode":200}

When my app is correctly installed the apns http2 api works ok while sending messages, my reponse is something of the style :{"response":"","httpcode":200}

问题是,当我卸载应用程序并向无效注册 ID 发送推送通知时,我没有收到状态 410 或响应原因:未注册",但仍然收到状态为 200 的真实响应.

The problem is that when i uninstall the app and send a pushnotification to the invalid registrationId i dont receive status 410 nor the response "reason:Unregistered" and still receive a true response with status 200.

在 apns http2 中卸载应用程序时如何接收 410 状态和相应的响应?

How can i receive 410 status and correspondig response when unistall the app in apns http2?

推荐答案

这个技术说明可能有帮助,基本上

iOS 将为每个 APNS 环境(生产/沙盒)保留一个套接字连接,当您从 iOS 删除应用程序时,如果它是给定环境的最后一个应用程序,它也会终止该套接字连接,这会导致删除事件放弃了最后一个应用.

iOS will keep one socket connection per APNS environment (Production/ Sandbox) and when you delete the app from iOS, if its a last app for a given environment it kills that socket connection as well, which causes the deletion event to be dropped for that last app.

这通常发生在开发应用中.

This generally happens with development apps.

解决方案是在注册 APNs 并使用开发者身份签名的设备上安装一个虚拟应用程序,现在当您在开发过程中从设备中删除您的真实应用程序时,它将保持与 APNS 的连接,导致应用程序被删除向 APNS 报告.

The solution is to keep a dummy app installed on a device which registers for APNs and is signed with developer identities, now when you delete your real app from device during development it will keep the connection to APNS open resulting in app deletion being reported to APNS.

此外,在我的测试中,在 APNS 响应中反映应用删除之前,我遇到了大约 30-60 分钟的延迟.

Also, In my testing I have experienced delays around 30-60 mins before an app deletion is reflected in APNS Response.

这篇关于卸载应用程序后,apns http2 api 不返回状态 410的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 20:21