Apple 推送通知服务器 - 反馈始终返回零元组

发布于 2024-09-12 09:30:02 字数 240 浏览 5 评论 0原文

我正在开发一个使用 Apple 推送通知的 iPhone 应用程序。在 iPhone 端一切都很好,在服务器端我遇到了问题。通知发送正确,但是当我尝试查询反馈服务以获取已卸载应用程序的设备列表时,我总是得到零结果。我知道我应该获得一个结果,因为该应用程序已从我的一台测试设备上卸载。 24 小时或更长时间后,我仍然没有收到反馈服务的结果。

有什么想法吗?有谁知道反馈服务需要多长时间才能识别出我的应用程序已从我的测试设备上卸载?难道是沙箱环境的原因?

I am developing an iPhone App that uses Apple Push Notifications. On the iPhone side everything is fine, on the server side I have a problem. Notifications are sent correctly however when I try to query the feedback service to obtain a list of devices from which the App has been uninstalled, I always get zero results. I know that I should obtain one result as the App has been uninstalled from one of my test devices. After 24 hours and more I still have no results from the feedback service..

Any ideas? Does anybody know how long it takes for the feedback service to recognize that my App has been uninstalled from my test device? Could it be due to the sandbox environment?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

深海蓝天 2024-09-19 09:30:03

正如 Zakum 在评论中所说,如果您删除最后一个启用推送的应用程序,该设备将不会添加到列表中。

(并确保给它足够的时间 - 也许 10 到 20 分钟。)

来自 Apple 文档:

如果您从设备或计算机中删除应用程序,然后向其发送推送通知,您会期望拒绝设备令牌,并且无效的设备令牌应出现在反馈服务上。 但是,如果这是设备或计算机上最后一个支持推送的应用,则它将不会显示在反馈服务中。这是因为删除最后一个应用会破坏与推送服务的持久连接在发送删除通知之前。

您可以通过在设备或计算机上保留至少一个支持推送的应用来解决此问题,以保持持久连接。要保持与生产环境的持久连接,只需从 App Store 安装任何免费的支持推送的应用程序,然后您应该能够删除您的应用程序并看到它出现在反馈服务中。

回想一下,每个推送环境都有自己的持久连接。因此,要保持与沙盒环境的持久连接,请安装另一个支持开发推送的应用程序。

As Zakum said in a comment, the device will not get added to the list if you delete the last push-enabled app.

(And make sure to give it enough time - maybe 10 to 20 minutes.)

From Apple Documentation:

If you remove your app from your device or computer and then send a push notification to it, you would expect to have the device token rejected, and the invalidated device token should appear on the feedback service. However, if this was the last push-enabled app on the device or computer, it will not show up in the feedback service. This is because deleting the last app tears down the persistent connection to the push service before the notice of the deletion can be sent.

You can work around this by leaving at least one push-enabled app on the device or computer in order to keep the persistent connection up. To keep the persistent connection to the production environment up, just install any free push-enabled app from the App Store and you should then be able to delete your app and see it appear in the feedback service.

Recall that each push environment has its own persistent connection. So to keep the persistent connection to the sandbox environment up, install another development push-enabled app.

七月上 2024-09-19 09:30:02

我刚刚遇到了完全相同的问题:

int bytesReceived = 0;
byte[] feedbackPacket = new byte[38];   // Each feedback should always be 38 bytes long
bytesReceived = stream.Read(feedbackPacket, 0, feedbackPacket.Length);
while(bytesReceived > 0)
{
    ProcessFeedback(feedbackPacket);
    Array.Clear(feedbackPacket, 0, feedbackPacket.Length);
    bytesReceived = stream.Read(feedbackPacket, 0, feedbackPacket.Length);
}

在沙箱上,上面总是返回 0 bytesReceived。我在实时主机上运行了这个,向设备发送一个通知,删除应用程序并发送第二个通知。反馈服务在发送第二个请求后一秒内开始工作。

我还没有发现的一件事是多久拨打一次反馈服务。我现在每 10 分钟打电话一次。

I have just had exactly the same problem:

int bytesReceived = 0;
byte[] feedbackPacket = new byte[38];   // Each feedback should always be 38 bytes long
bytesReceived = stream.Read(feedbackPacket, 0, feedbackPacket.Length);
while(bytesReceived > 0)
{
    ProcessFeedback(feedbackPacket);
    Array.Clear(feedbackPacket, 0, feedbackPacket.Length);
    bytesReceived = stream.Read(feedbackPacket, 0, feedbackPacket.Length);
}

On the sandbox, the above always returned 0 bytesReceived. I ran this on the live host, sending a single notification to a device, removing the app and sending a second. The feedback service work within a second of sending the second request.

One thing I haven't found is how often to call the feedback service however. I'll calling every 10 mins at the moment.

燕归巢 2024-09-19 09:30:02

我在沙盒环境中遇到了同样的问题。反馈服务返回零元组。

我切换到生产环境来测试我的代码,一切正常。当我从设备上卸载应用程序并发送一对推送通知后,该设备就出现在反馈列表中。

I had the same problem with sandbox environment. Zero tuples return by the feedback service.

I switched to production environment to test my code and everything worked fine. As soon as I uninstalled the app from the device and sent a pair of push notification, this device appeared in the feedback list.

暖伴 2024-09-19 09:30:02

虽然我不能明确地说它在沙箱环境中不起作用,但我对此非常确定。在生产环境中,卸载应用程序后,我发送了一些(我猜是 3 个)推送通知。然后反馈服务返回除零元组以外的结果。 (大约十分钟)

与本例无关,而且为了获得通知并获得反馈结果,您的网络应该允许APNS使用的端口。

Although I can't say definetly it does not work in sandbox environment, i'm pretty sure about it. In production environment, after uninstalling my application, I sent a few (i guess 3) push notifications. Then feedback service returned results other than zero tuples. (about in ten minutes)

It is not related with this case, but also in order to get notifications and also get feedback results, your network should allow ports that APNS use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文