对于IOS推送通知,我使用下面的代码并从c#.net Windows Servervice运行
var settings = FileBasedFcmClientSettings.CreateFromFile("c:\\fcm.json");
// Construct the Client:
using (var client = new FcmClient(settings))
{
var notification = new Notification
{
Title = "message_tobeSent",
Body = "message_tobeSent",//change later
}
// The Message should be sent to the News Topic:
var message = new FcmMessage()
{
ValidateOnly = false,
Message = new Message
{
Notification = notification,
Token = token //dynamic value
}
};
// Finally send the Message and wait for the Result:
CancellationTokenSource cts = new CancellationTokenSource();
// Send the Message and wait synchronously:
var result = client.SendAsync(message, cts.Token).Result;
在上面的代码中,以下代码行返回了空值 client.SendAsync(message,cts.Token) 如果我从控制台应用程序运行相同的代码,则它的工作原理 请建议我,我想念的是什么?