How to re-enable an Amazon SNS endpoint with the iOS SDK?


I’m using Amazon SNS to send push notifications to my iOS app.

For whatever reason, my endpoints occasionally seem to get set to “false” – even though I know that they are valid endpoints (because re-enabling them then delivers new push notifications to the device). There’s a similar Stack Overflow question here – but no technical answer as to how to resolve the issue.

So: I need to figure out how to set the endpoint as enabled.

There’s only sparse Amazon documentation for how to do this, so what I do know is that I need to use the “enabled” key/value in the attributes dictionary.

My snippet of code looks like this:

This works perfectly, except for a single line of code, which sets the attributesValue “Enabled” to “true”. I’ve tried all of these combinations:

…yet none of them work. What is the proper way to write this line of code? Should I be using a BOOL somehow? An integer?


There are some conditions which I have found so far in which endPoint attributes gets false even though endpoints and tokens are correct

  1. If you have created the amazon sns app with Production APNS certificate but you try to register your device with SANDBOX APNS i.e. Development APNS then it will get false
  2. When user turns off notifications in Phone Settings then apple APNS disables the flag which affects in amazon sns too. whenever user enables the notification again you have resend the token to amazon to setattribute true i.e. need to handle on client side
  3. When user removes/unistalls the app

Leave a Reply