APNS and Azure Notification hub - debug VS release

BjoernChristianBjoernChristian USMember
edited September 2017 in Xamarin.iOS

Hi,

does anyone have any advice on best practice for setting up Azure Notification Hub and APNS? More specifically, my app receives push messages in DEBUG mode. And it does this even though I have created PRODUCTION certificate for push used in the provisioning profile. But no push-message comes through when I use release or ad-hoc mode (using of course different provisioning profile, but ad-hoc provisioning profile uses same App Id as development provisioning profile). This leads me to the following questions that I hope someone have some input on.
1) Why does push messages work with APNS in DEBUG mode with PRODUCTION certificate?
2) If we need to use 2 certificates, 1 for dev and 1 for production; How do you guys set up this environment? Do we need to have 2 different Notification Hubs set up, where we duplicate the Google service and upload 2 different certificates from Apple?
3) If we don´t have to use 2 different Push certificates with Apple, but can stick to the production, do you have any clues on why it doesn´t work for my Release or Ad-Hoc version? I have tried the following;

  • Turning off linking
  • Turing off dotfuscator
  • Tried updating Entitlements.plist to include BOTH Push notifications and aps-environment = Production. However, Visual Studio won´t stop overriding the aps-environment key so when I click enable Push in entitlements.plist in Visual Studio, then in the background VS sets "production" back to "development". (However, it works in Debug mode WITHOUT having the Entitlement.plist set Push to ON. This leads me to believe I don´t need the Entilement.plist Push to be set to on).
    (And yes, I do have different provisioning profiles for development and distribution. They are using the same App Id (where the push setting and certificate is set)

Any help on this matter would be greatly appreciated! It has now cost me several days in troubleshooting without any luck:(

Best regards,
BC

Best Answers

  • Accepted Answer

    Hi,

    thanks for your reply! Helpful as always:) And it´s a great option with XamU, I will definitely use this in the future.
    The lightening course you sent was also a great introduction to the topic! It gave a good overview, the only thing it was missing was the production-environment bit. Since I have now been able to solve it I thought I could give the final piece of the solution in case anyone else struggles with this (there are some posts out there suggesting that more people have encountered this:)

    Solution:

    • Follow the lightening lecture from Mark in this thread
    • Use production certificate for any build that is NOT debug (this includes ad-hoc)
    • IMPORTANT: Open Entitlements.plist in notepad++ or similar, and change asp-environment to "production"
    • IMPORTANT: In your notification hub in azure, place this in PRODUCTION mode for all builds that is NOT debug (this includes ad-hoc)

    I hope this helps in case anyone else should be in some pain due to this challenge:)

Answers

  • BjoernChristianBjoernChristian USMember
    Accepted Answer

    Hi,

    thanks for your reply! Helpful as always:) And it´s a great option with XamU, I will definitely use this in the future.
    The lightening course you sent was also a great introduction to the topic! It gave a good overview, the only thing it was missing was the production-environment bit. Since I have now been able to solve it I thought I could give the final piece of the solution in case anyone else struggles with this (there are some posts out there suggesting that more people have encountered this:)

    Solution:

    • Follow the lightening lecture from Mark in this thread
    • Use production certificate for any build that is NOT debug (this includes ad-hoc)
    • IMPORTANT: Open Entitlements.plist in notepad++ or similar, and change asp-environment to "production"
    • IMPORTANT: In your notification hub in azure, place this in PRODUCTION mode for all builds that is NOT debug (this includes ad-hoc)

    I hope this helps in case anyone else should be in some pain due to this challenge:)

Sign In or Register to comment.