IOS Apple APNS 消息推送 C#

JackDengdll 2012-12-06 06:12:12
各位大神,我正在用C# 做的一个关于苹果的消息推送,我用了一个老外源代码中的两个专案,老外的源码我就不贴出来了,因为我看到网上基本上写消息推送都用的是他写的那个源码。JdSoft.Apple.Apns.Notifications和JdSoft.Apple.Apns.Notifications.Test,

只在JdSoft.Apple.Apns.Notifications.Test里面改了一下代码,把P12档和token还有密码改成了我自己这边的,然后跑起来试试。(另外,我要声明的是我电脑的防火墙都关掉了。)

但是我的apple一直收不到讯息。程序console .Write如下

Notification Queued!

Sleeping 15000 milliseconds before next Notification...

Connected...

Notification Success:{"aps":{alert":"Testing 1...""badge":1,"sound":"default"}}

Notification Queued!

Sleeping 15000 milliseconds before next Notification...

Error:无法将数据写入传输连接:您的主机中的软件中止了一个已机建立的连接。。

Connection...

Connected...

Notification Success:{"aps":{"alert":"Testing 2...","badge":2,"sound":default"}}

Notification Queued!

Error:无法将数据写入传输连接:您的主机中的软件中止了一个已建立的连接。。

Cleaning Up...

Cnection...

Notification Success:{"aps":{alert":"testing 3...","badge":3,"sound":"default"}}

done!

Press enter to exit...

不知道错误出在哪里了。请指教,谢谢。

客服端手机一直没有收到信息。
...全文
1353 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
dongxxxx 2014-04-17
  • 打赏
  • 举报
回复
NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1);
dongxxxx 2014-04-17
  • 打赏
  • 举报
回复
如果是production 证书 要把 sandbox=false 吧
protek090330 2013-08-19
  • 打赏
  • 举报
回复
我这里也是这样的问题,之前用那个测试证书是好的,改成发布证书就报这个错。
fmricky 2013-04-25
  • 打赏
  • 举报
回复
引用 楼主 JackDengdll 的回复:
各位大神,我正在用C# 做的一个关于苹果的消息推送,我用了一个老外源代码中的两个专案,老外的源码我就不贴出来了,因为我看到网上基本上写消息推送都用的是他写的那个源码。JdSoft.Apple.Apns.Notifications和JdSoft.Apple.Apns.Notifications.Test, 只在JdSoft.Apple.Apns.Notificatio……
我也遇到你的这个问题,请问你现在解决了吗?
hua11018818 2013-01-05
  • 打赏
  • 举报
回复
有两个证书,是不是用错了;检查你发布的app启用了推送没有
JackDengdll 2012-12-06
  • 打赏
  • 举报
回复
自己顶一下,谁知道苹果的推送apns吗

29,027

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧