Fail to setup one AWS SNS to serve both development (APNS_SANDBOX) and production (APNS)
Asked Answered
E

2

5

Maybe this is not supported by AWS, however, when creating a certification on Apple Developer Console I chose "Apple Push Notification service SSL (Sandbox & Production)". I used this certification to set up an SNS. If I check the "Used for development in sandbox" checkbox, the notifications will work when compiling the app via XCODE but not via testflight, if I use this certification and I uncheck this checkbox the notifications will work from testflight but from XCODE.

I was under the impression that this new type of certification can be used in development and production, so I'm little bit confused. It seems like AWS knows if my app is compiled for development or production.

Is there a way to set up one SNS for development and production on iOS?

Equivocation answered 10/7, 2020 at 9:19 Comment(0)
G
8

I just went through this today with my AWS team. (I'm an iOS developer so forgive me if I don't use the correct AWS terminology. Hopefully it's close enough.)

The new certificate CAN be used for both Sandbox and Production. However, an AWS SNS endpoint (ARN?) has to be created for each one. As you stated if you check the "Used for development in sandbox" checkbox it will start working when running from Xcode, but it won't work for the TestFlight app. It's either/or, not both.

To get this working, you need to create two SNS endpoints. You can use the same "Apple Push Notification service SSL (Sandbox & Production)" APNS certificate for both endpoints, but only check the "Used for development in sandbox" in one of them.

I don't know if this applies to your situation, but for my app our AWS team added a "development" flag to our device registration API so they can differentiate on their end whether to send the notification to the APNS or APNS_SANDBOX endpoint.

Golanka answered 3/11, 2020 at 21:35 Comment(1)
yeah, I also found this out before just forgot to write an answer. Thank you.Equivocation
T
0

For anyone who might need a bit more clarification, I will try to explain the problem you might face and then a solution.

Problem Statement:

  1. You created an AWS SNS platform application for Apple iOS/VIOP/MacOS and ticked "Used for development in sandbox".

  2. You end up getting an arn that has "APNS_SANDBOX" somewhere in the string.

  3. You then use the platform arn to register device endpoints. Take note these devices were built using Xcode (debug/release) and not the one on the App Store.

  4. It works, notifications are being delivered.

  5. You then publish your app to the App store or TestFlight and suddenly notice that notifications are not being delivered.

  6. On top of that, you notice that your endpoints status show up as disabled, now you're wondering why your village people have decided to pick on you today.

Solution:

  1. You need to create another AWS SNS platform application but this time don't tick "Used for development in sandbox"

  2. Make sure to use the same name as the sandbox one or a different one. The main difference is the APNS_SANDBOX or APNS in the endpoint.

  3. Now go into your code and use the arn with only APNS for apps that you submit to the App Store.

Cheers

Termitarium answered 22/3, 2022 at 18:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.