Search code examples
apple-push-notificationstestflightazure-notificationhub

Unclear error message on sending a notification to iOS


I'm trying to send a notification via C# SDK. I'm sending notifications for iOS.

string payload = "{\"aps\" : { \"alert\" : \"Message received from Bob\" }}";
var outcome = hub.SendAppleNativeNotificationAsync(payload, new[] { "b6a5d9c3-4297-422f-9a8d-b7979c30a5f8" }).GetAwaiter().GetResult();

Registration works fine, I can retrieve registered users, but I receive errors on sending. The error message is

Contract mismatch between ServiceBus and the Push Notification System

I've looked into manage.windowsazure.com for monitoring and saw that there were errors of type “Bad channel error”.

I assume that I should try to change my region for NH and probably the problem will go away, but is there anything else I could look at to resolve this issue?

Forgot to mention that everything was working on the first day I started to work with push notifications and only after several days became broken without any changes.


Solution

  • I didn't figured out what does that error mean but at least found the root cause. It was Testflight that by some obscure reasons uses production gateways to send notifications and not sandbox, and my NH has been configured with sandbox certificate, that's why it didn't work.