c# - 如何实现通过 C# 发送 Expo.io 推送通知
问题描述
我想在以下代码中实现expo.io
推送通知,抛出错误说:C#
当前上下文中不存在 JsonExtension
.
{
public static dynamic SendPushNotification(string ExpoToken)
{
dynamic body = new
{
to = ExpoToken,
title = "hello",
body = "world",
sound = "default",
data = new { some = "daaaata" }
};
string response = null;
using (WebClient client = new WebClient())
{
client.Headers.Add("accept", "application/json");
client.Headers.Add("accept-encoding", "gzip, deflate");
client.Headers.Add("Content-Type", "application/json");
response = client.UploadString("https://exp.host/--/api/v2/push/send", JsonExtensions.ToJson(body));
}
var json = JsonExtensions.FromJson<dynamic>(response);
return json;
}
}```
解决方案
推荐阅读
- javascript - JQuery 项目不可点击甚至设置点击(真)
- javascript - Mongoose TypeError:无法读取未定义的属性“googleID”
- svg - 将 react-svg-loader 添加到 webpack
- java - 如何在两个字符串中找到导致它们不相等的字符?
- java - Spring Boot 2 @WebMvcTest 和 OAuth2 #oauth2.hasScope 控制器导致 IllegalArgumentException
- facebook - Facebook Graph API:如何找到 object_id?
- javascript - JavaScript:删除数组中所有重复的元素?
- asp.net - 删除列后不触发 GridView RowCommand
- angular - Angular 反应式表单输入验证在负载上不起作用
- python - VS Code Python 超时等待调试器连接