【问题标题】:Apple Push Notification using .net http2使用 .net http2 的 Apple 推送通知
【发布时间】:2018-05-25 22:45:12
【问题描述】:
我正在尝试使用 c# dot net 代码发送苹果推送通知。因为我可以使用发送通知
gateway.sandbox.push.apple.com
但我需要使用以下主机发送通知
api.development.push.apple.com
API 的。
任何人都可以发送基于证书或基于令牌的发送通知的代码或链接
提前致谢。
【问题讨论】:
标签:
c#
ios
asp.net-web-api
apple-push-notifications
http2
【解决方案1】:
使用 .NET Core,您可以将这个轻量级 library 用于 APN HTTP/2 推送通知(如果需要,还可以使用 FCM):
Install-Package CorePush
这是基于 JWT 令牌的发送:
using (var apn = new ApnSender(
p8privateKey,
p8privateKeyId,
teamId, appBundleIdentifier, server))
{
await apn.SendAsync(deviceToken, notification);
}