PushSharp notifications to iOS are not reaching device
Asked Answered
Z

1

1

I am attempting to use the PushSharp library for apple push notifications in a c# service I am running.

The code all appears to execute correctly, there are no errors and it seems all things are done correctly. However the notification never reaches my application.

Everything Ive read seems to conclude the issue is my certificate, but ive re-downloaded, and redone the steps numerous times and everything seems to be correct with it.

Here is my PushSharp c# code

            string pushCertPath = string.Format(string.Format("{0}\\PushCert (DEV).p12", dataPath));
            var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, pushCertPath));
            PushBroker push = new PushBroker();
            push.RegisterAppleService(new ApplePushChannelSettings(false, appleCert,"pushcert"));

           push.QueueNotification(new AppleNotification()
           .ForDeviceToken("594c78b070698ded0a5f3dc1503a42e3983b7c1d254b61a98cc6e5eb0e8b7edd")
           .WithAlert("You have received new messages")
           .WithSound("default")
           .WithBadge(1));
Zwart answered 16/4, 2014 at 17:55 Comment(0)
M
1

I got the same problem too since from yesterday. I just tried change the SslProtocols from SslProtocols.Ssl3 to SslProtocols.Default make it works again. So Apple must change something and refuse the Ssl3 protocol.

    stream.AuthenticateAsClient(settings.FeedbackHost, certificates, System.Security.Authentication.SslProtocols.**Default**, false);
Marciemarcile answered 16/4, 2014 at 22:21 Comment(1)
Thanks user3543150 for commenting on my question which appeared about the same time! I implemented the change recommended here https://mcmap.net/q/895608/-pushsharp-apple-the-message-received-was-unexpected-or-badly-formatted . It seems to be similar to what you recommend.Harmon

© 2022 - 2024 — McMap. All rights reserved.