[英]How to test Apple Push Notifications Feedback Service?
What I did as a test is following: 我作为测试做的是:
I made example app where I enabled push notifications and implemented mechanism for handling them. 我做了示例应用程序,我启用了推送通知并实现了处理它们的机制。
I was testing sending of silent push notifications to my app with curl
and that works pretty well. 我正在测试使用
curl
向我的应用程序发送静音推送通知,这非常有效。 I am testing that with: 我测试的是:
curl -v -d '{"aps":{"content-available":1}}' --cert "/Users/me/Desktop/mycert.pem":"" -H "apns-topic:com.domain.name" --http2 https://api.development.push.apple.com/3/device/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX curl -v -d'{“aps”:{“content-available”:1}}'--cert“/Users/me/Desktop/mycert.pem”:“ - ” - H“apns-topic:com.domain .name“--http2 https://api.development.push.apple.com/3/device/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
As an answer from Apple, I am always seeing following: 作为Apple的回答,我总是看到以下内容:
< HTTP/2.0 200
<HTTP / 2.0 200
< apns-id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX
<apns-id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX
Which is fine and as expected, according to Table 6-4
from the official docs: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html 根据官方文档中的
Table 6-4
,这是正常的和预期的一样: https : //developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html
Now I delete the app from my device and I retry the same request kinda hoping that I will start getting status code 410
and info that The device token is no longer active for the topic
. 现在我从我的设备中删除了应用程序,然后我重试相同的请求,希望我将开始获取状态代码
410
和信息The device token is no longer active for the topic
。 How ever, that doesn't happen and I am always getting 200
status code like everything's fine and that the push token is still available. 然而,这不会发生,我总是得到
200
状态代码,就像一切都很好,并且推送令牌仍然可用。
1 - 1.5 hours after deletion, I am still getting 200
as an answer. 删除后1 - 1.5小时,我仍然得到
200
作为答案。
Do you maybe know how often does Apple refresh push tokens list and when I can expect to eventually start getting 410
? 您是否知道Apple刷新推送令牌列表的频率以及何时可以最终开始获得
410
? And also - is 410
status (and Instant Feedback
in general) testable at all while testing the app outside of production environment? 而且 - 在生产环境之外测试应用程序时,
410
状态(以及一般的Instant Feedback
)是否可测试?
Thanks in advance for any kind of answer. 提前感谢任何答案。
Cheers 干杯
Okay, so from what I have discovered, seems that Instant Feedback
service from Apple is working just fine and is able to detect uninstall pretty fast. 好的,从我发现的情况来看,Apple的
Instant Feedback
服务似乎运行得很好,能够快速检测卸载。 There was a small trick in how to test these things properly with sandbox service. 如何使用沙盒服务正确测试这些东西有一个小技巧。
If you make an app which you are testing locally on your device and your app is the only one installed on your phone from that provisioning profile (vendor) , stuff which I faced as an issue in my question will be encountered. 如果您制作的应用程序在您的设备上进行本地测试,并且您的应用程序是手机中安装的唯一一个应用程序配置文件(供应商) ,则会遇到我在问题中遇到的问题。 For some reason, even if you uninstall the app (which was the only one on the phone installed from your provisioning profile), Apple is always responding with 200.
出于某种原因,即使您卸载了应用程序(这是从配置文件中安装的手机上唯一的应用程序),Apple总是以200响应。
What needs to be done is following: After you install your app which you are testing, create a new dummy app with another bundle ID, but which also coming from your provisioning profile, enable push notifications in it as well and install it on your device. 需要做的是:安装您正在测试的应用程序后,使用另一个软件包ID创建一个新的虚拟应用程序,但也来自您的配置文件,在其中启用推送通知并将其安装在您的设备上。 So now, you have two apps that you made - one which you are developing and testing the
Instant Feedback
service with and another one which kinda "zombie" app which just sits in there and does nothing. 所以现在,你有两个应用程序 - 一个是你正在开发和测试
Instant Feedback
服务,另一个是有点“僵尸”应用程序,它只是坐在那里,什么都不做。
After this, uninstall your test app, try to send silent push notification and Apple will respond with status code 410
as expected. 在此之后,卸载您的测试应用程序,尝试发送静默推送通知,Apple将按预期响应
status code 410
。
Dummy way, but for some reason that's how it should be while testing. 虚拟的方式,但由于某种原因,这是测试时应该如何。 Behaviour in production should be as expected and w/o any need to have a dummy (or any other) app from same vendor installed on iOS device.
生产中的行为应该符合预期,并且不需要在iOS设备上安装来自同一供应商的虚拟(或任何其他)应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.