Reputation: 3575
I have a trigger.io app that is using UrbanAirship for push notifications. Everything works fine on android. I also had push notifications working on ios. However, at some point push notification stopped working on ios. Turns out that my device tokens were getting marked as inactive by UrbanAirship - according to them, it happens when apple rejected the device token.
I created a new ios provisioning profile and re-built the app - after I installed the new version a few days ago everything started working again. Today push notifications stopped working, and my device token is marked an inactive again.
As suggested by UrbanAirship, I register a new device token every time the user logs in.
I'm using trigger.io reload to dynamically push code to my app - is it possible that apple detects that I'm updating my app, and as a punishment decides to deactivate the device token?
p.s - Apple's unnecessary long review process, lack of debugging tools, and general red tap really don't help in this case.
Upvotes: 1
Views: 675
Reputation: 993
Here is a possibility: If the user of your app opted out notifications specifically from your app and if you keep sending notifications that may result in Apple deactivating the device token and subsequently Urban Airship marking it as such.
https://github.com/groupon/urbanairship
The first time you attempt to send a push notification to a device that has uninstalled your app (or has opted-out of notifications), both Apple and Urban Airship will register that token in their feedback API. Urban Airship will prevent further attempted notification sends to that device, but it's a good practice to periodically poll Urban Airship's feedback API and mark those tokens as inactive in your own system as well.
If the user opts in notifications from your app again, Apple may mark the device token active, but I am unsure whether Urban Airship detects the status change. From the following excerpt I interpret that Urban Airship counts on you to re-register the device token to make notifications work again. http://docs.urbanairship.com/api/ua.html#device-registration-apis
Why use the registration call? We query Apple’s feedback service for you, marking any device tokens they tell us are inactive so you don’t accidentally send anything to them in the future. The registration call tells us that the device token is valid as of this time, so if a user re-installs your application they can receive them successfully again.
You don't have to do the re-registration explicitly if your app uses iOS Mobile Client Library from Urban Airship.
If you are using the iOS mobile client library, registration is handled for you. Calling this API from a server might interfere with metadata if set differently. Specifically, if you set an alias from the API but are using the library, the library will clear the alias upon registration.
Upvotes: 0