2017-09-07 15 views
1

Azure Notification HubとXamarin.Macでプッシュ通知を送信しようとしています。 私にはこのエラーがあり、理由はわかりません。誰かが私にそれに対処するのを助けることができますか?Xamarin.Mac - 通知を送信する

エラー:

System.TypeInitializationException: The type initializer for 'TimerManager' threw an exception. ---> System.EntryPointNotFoundException: CreateWaitableTimer 

マイコード:

private static async void SendNotificationAsync() 
{ 
    NotificationHubClient hub = NotificationHubClient 
     .CreateClientFromConnectionString("<connection string>", "<hub name>"); 
    string toast = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + 
     "<wp:Notification xmlns:wp=\"WPNotification\">" + 
      "<wp:Toast>" + 
       "<wp:Text1>Content</wp:Text1>" + 
      "</wp:Toast> " + 
     "</wp:Notification>"; 
    await hub.SendMpnsNativeNotificationAsync(toast); 
} 

答えて

2

Windowsデスクトップ固有のものであり、などのモノ、UWP、Win10のIoT、で利用できない、そのライブラリのいくつかの領域があります。 (CreateWaitableTimerのような項目はネイティブのWindowsデスクトップAPI呼び出しです)。

アズールは、異なるクライアントとライブラリの数を持っているほとんどの「ポータブル」はREST APIです、MPNSネイティブ通知を送信することにPOSTを実行する必要:ドキュメントが必要なコンテンツとヘッダを示し

https://{namespace}.servicebus.windows.net/{NotificationHub}/messages/?api-version=2015-01 

+0

おかげであなたの答えのために、私はREST APIを使用します。それは私の問題には最高の解決策だ:) :)ありがとう! –

関連する問題