PushSharp Apple - The message received was unexpected or badly formatted

前端 未结 2 408
孤城傲影
孤城傲影 2020-12-16 00:58

I am using version 2.1.2 of PushSharp. The app is .NET 4.5.1 (although I have also tried targeting .NET 4.5 and .NET 4)

I am trying but not succeeding to send push

相关标签:
2条回答
  • 2020-12-16 01:03

    We were having the same issue using the now deprecated APNS-Sharp library (ancestor to PushSharp). I submitted a pull request for APNS-Sharp that fixes the issue based on my tests.

    The modification was to change (in ApplePushChannel.cs)

    stream.AuthenticateAsClient(this.appleSettings.Host, this.certificates, System.Security.Authentication.SslProtocols.Ssl3, false);                   
    

    to

    stream.AuthenticateAsClient(this.appleSettings.Host, this.certificates, System.Security.Authentication.SslProtocols.Tls, false);
    

    I didn't find a confirmation on this, but it looked like the SSL3 protocol was no longer supported by the Sandbox APNS. Like others that reported the issue, my notifications against the Production APNS were still working.

    You can find the pull request here:

    https://github.com/Redth/PushSharp/pull/369/files

    Update

    There is a thread on the Apple Developer web site on this topic:

    https://devforums.apple.com/thread/224320?tstart=0

    However, some of the people there are also on this thread or on the github thread. So the information is biased for sure. A contact that I have at Apple is saying:

    While there is no official documentation out yet, it seems like APNS is moving towards TLS rather than SSL (solely based on seeing this change - I have not heard anything official).

    0 讨论(0)
  • 2020-12-16 01:10

    If any of you are running this on Windows Server 2003 (I know, I know) you will have to run this patch or you will still get strange errors even after you implement the fix. I spent a few hours wondering why my 2008 server worked and my 2003 server didn't.

    http://support.microsoft.com/kb/948963

    0 讨论(0)
提交回复
热议问题