我试图用Azure通知中心和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);
}发布于 2017-09-08 01:15:18
该库中有几个特定于Windows的区域,无法在Mono、UWP、Win10 IoT等上使用。(像CreateWaitableTimer这样的项目是本地Windows调用)。
Azure有许多不同的客户端和库,最“可移植的”是REST,发送MPNS本机通知涉及执行一条帖子到:
https://{namespace}.servicebus.windows.net/{NotificationHub}/messages/?api-version=2015-01文档显示所需的内容和标题:
https://stackoverflow.com/questions/46105525
复制相似问题