I have followed this tutorial to create a push notification hub for an IOS app.
When i run the code
private static async void SendNotificationAsync()
{
NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(host, "sideview", false);
var alert = "{\"aps\":{\"alert\":\"Hello\"}}";
await hub.SendAppleNativeNotificationAsync(alert);
}
from static void Main(string[] args) of a console program , nothing happens, the console just stops.
If I use
private static void SendNotificationAsync()
{
NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(host, "sideview", false);
var alert = "{\"aps\":{\"alert\":\"Hello\"}}";
hub.SendAppleNativeNotificationAsync(alert).Wait();
}
everythings works fine
Update
As Yuval Itzchakov said in the answer bellow, Console Application's main method can't be marked async, so the async method will not be waited