c#关于iOS推送

本文介绍了使用C#进行iOS推送时遇到的问题,包括Notification Failed to be Queued!错误的解决方法,以及如何避免频繁连接APNs被禁。通过修改源码JdSoft.Apns.Notifications.dll,将SslProtocols.Ssl3更改为SslProtocols.Default。同时,文章展示了如何利用单例模式确保安全的连接管理。在源码分析部分,详细阐述了Notification.cs和NotificationService.cs中处理推送的过程。
摘要由CSDN通过智能技术生成

这个网上已经有比较好的技术了,可以下载别人的代码,稍微改动即可。
我用的是JdSoft.Apns.Notifications.dll 源码已上传
关于遇见的问题
1、Notification Failed to be Queued!
这个问题是由于源码中System.Security.Authentication.SslProtocols.Ssl3造成的
将其修改为System.Security.Authentication.SslProtocols.Default即可
如果找不到在哪,就全局搜索下
(或者可以看看这个文件中有没 NotificationChannel.cs)
2、关于频繁链接apns是否会被禁掉,这个的应该是会会禁掉的,但是此源码中已经有封装了
但是为了保险又用单例做了一遍`

class NotificationServiceManager
{
private static NotificationService service = null;
private static object objLock = new object();
private bool Sandbox;
private string FileName;
private string FilePwd;
public NotificationServiceManager(bool sandbox, string token, string fileName, string filePwd)
{
Sandbox = sandbox;
FileName = fileName;
FilePwd = filePwd;
}

    public NotificationService Service
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值