apns http2 api not returning status 410 after uninstalling app
Asked Answered
C

3

10

Im using apns with http2 protocol for sending pushnotifications, the code i use is similar to this post: https://mcmap.net/q/571952/-new-apns-provider-api-and-php

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}

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.

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

Cuellar answered 2/9, 2016 at 10:50 Comment(2)
Were you able to detect this issue?Com
Having the same problem. Any solution?Lynch
L
5

This technical note might be of help, basically

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.

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.

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

Lehmann answered 3/9, 2016 at 16:7 Comment(3)
thanks dude, but i created another app signed with developers identity (the same certificate) and different provisional-profile because you cant use the same provisional-profile with different bundle-ids and didnt work. I suppose that ive to use a dedicated device to not loose the service. Also i dont think is possible what the technocal-note says in " 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" .. do this make sense to you?Cuellar
Quote from note, "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." the suggested app store install is for production case only. Having a dummy dev app install should fix the issue. Also, is your question specific to http2 api? Do you get uninstalls right from feedback service in binary api?Lehmann
The note you linked to is part of the legacy documentation. The question is referring to the http2 api, which is documented here. I've also found in my testing using the http2 api that it may take at least 10 minutes for the push to fail due to the app being 'Unregistered'.Persevere
S
3

Here is my 410 status experience on APNS prod service; After removal of distribution application on device, I could get 410 response a few time, but then, after spending too much time on testing of APNS Http/2 API, I noticed that It returns always success(http 200) response for the previous device tokens which belongs removed application, even after 2–3 days.

I found these two lines of log in device after adding apns logging profile:

APSCourier: Received message for recently removed topic ‘com.xxx.xxx.xxx’
APSCourier: Sending acknowledgement message

I think, It is about asynchronous flow of receiving notification of removed topic on device and sending its acknowledgement message to the back APNS from device. Somehow APNS does not take action about these acknowledgements.

By considering the current state of APNS behaviour, using new APNS Notification Service to having it as a part of uninstallation tracking process is not a right approach for now.

Instead of APNS, you can execute background task to ping your server for letting you to detect about uninstallation status.

And want to share a few link from apple developer forums, discussing parallel topics:

APNs token still valid after app uninstalled

Older APNs device tokens do reach the device

Old APNs tokens not invalidating?

How do APNS HTTP/2 and APNS HTTP/1.1 Work together?

When does APNS report an uninstall?

Saba answered 3/10, 2018 at 10:49 Comment(1)
could you share more details. I'm trying to detect uninstall and I'm always getting 200 in curl request.Phenacetin
L
0

You should also try the old feedback service, it still works.

NWPusher is a quick way to check.

Litalitany answered 14/10, 2018 at 10:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.