Following the instructions, I am having issue getting notifications working in a production environment.
Steps followed:
Is there a clear way to get this to work in production? Thank you for your time and sorry for annoying the Docs Team!
--
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@raymond-dillon Thanks for the question! We are taking a look into this and will get back to you soon.
Apologies for the delay! If have understood your issue correctly.
As mentioned in this document. The tutorial uses a development certificate. The same process is used when registering a production certificate. Just make sure that you use the same certificate type when sending notifications. Use the Production for Application Mode only if you want to send push notifications to users who purchased your app from the store.
You must maintain two different hubs: one for production and another for testing. You must upload the certificate you use in a sandbox environment to a separate hub than the certificate/hub you'll use in production. Don't try to upload different types of certificates to the same hub. It will cause notification failures.
If you inadvertently upload different types of certificates to the same hub, you should delete the hub and start fresh with a new hub. If for some reason you can't delete the hub, you must at least delete all the existing registrations from the hub.
A failure to deliver notifications might occur during the initial test/staging phase. Dropped notifications at this stage might indicate a configuration issue. If a failure to deliver notifications occurs in production, some or all of the notifications might be dropped. A deeper application or messaging pattern issue is indicated in this case.
Hi @AjayKumar-MSFT - thanks for getting back to me. I have two separate hubs for my app (a development hub and a production hub).
Development works fine - I can send and receive notifications.
In production, following https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started#create-a-provisioning-profile-for-the-app - I create an App Distribution provisioning profile.
On the certificate selection, what do I need to select? I have certificates for "iOS Distribution" and simply "Distribution (for use in XCode11 or later"
Do I need to take the certificate from my Bundle ID (Production) and somehow attach to the Distibution profile?
Also, is a "Release" build in VS enough to trigger the use of the production hub setup, or do I need to submit a build to TestFlight in order to trigger it? (i.e is there a way to test a production notification hub before submitting to TestFlight?).
Thank you for your time!
@raymond-dillon, The documentation calls out when you’re creating your app, to create certificates for both production and development, which are used for push notifications. This has to do with the production or development case here or you can use the token based authentication as discussed in option 2.
Once those certs or tokens have been created, then you need to create a provisioning profile, either production or development mode so that you can deploy the app. Once the device has been registered for development by the app, it is good only for development, not production. Then the development credentials should be set on the Notification Hub, depending on the method chosen either the p12 or p8 file -kindly checkout this document.
In other words as noted here, when you build your app using a development cert, the app will generate a unique device token. This device token will not work on the production push network. When you then build your app with a distribution provisioning profile (App Store or Ad-Hoc) your device will generate a different device token for push notifications. If you try to send the development generated token to the production push SSL network, Apple's servers will reject your token.
Hope this helps! Kindly let us know if you have any further questions.
We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion.