Ich verwende PushSharp, um iOS-Benachrichtigungen an eine Anwendung zu senden.Ich kann keine Push-Benachrichtigungen über pushsharp auf adhoc-Verteilung senden
Ich habe es geschafft, um es nach dem Beispiel in einer Entwicklungsumgebung funktioniert, aber wenn ich versuche, sie in einer Produktionsumgebung ich die folgende Fehlermeldung an:
InnerException = {"No se pudo realizar una llamada a SSPI; consulte la excepción interna."
{"SSL Stream Failed to Authenticate as Client"}
Hier ist der Code:
var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, "path/to/file", "MyPassword", false);
// Create a new broker
var apnsBroker = new ApnsServiceBroker (config);
// Wire up events
apnsBroker.OnNotificationFailed += (notification, aggregateEx) => {
aggregateEx.Handle (ex => {
// See what kind of exception it was to further diagnose
if (ex is ApnsNotificationException) {
var notificationException = (ApnsNotificationException)ex;
// Deal with the failed notification
var apnsNotification = notificationException.Notification;
var statusCode = notificationException.ErrorStatusCode;
Console.WriteLine ("Apple Notification Failed: ID={apnsNotification.Identifier}, Code={statusCode}");
} else {
// Inner exception might hold more useful information like an ApnsConnectionException
Console.WriteLine ("Apple Notification Failed for some unknown reason : {ex.InnerException}");
}
// Mark it as handled
return true;
});
};
apnsBroker.OnNotificationSucceeded += (notification) => {
Console.WriteLine ("Apple Notification Sent!");
};
// var i = JObject.FromObject(push);
// Start the broker
apnsBroker.Start();
apnsBroker.QueueNotification(new ApnsNotification
{
DeviceToken = "somedevicetokenthatiusetotest",
Payload = JObject.Parse("{\"aps\":{\"alert\":\"My custom alert\",\"badge\":\"1\"}, \"date\": \"2016-06-07T01:38:00.541Z\"}"),
});
// Stop the broker, wait for it to finish
// This isn't done after every message, but after you're
// done with the broker
apnsBroker.Stop();
Ich bin mir ziemlich sicher, dass es etwas mit den Zertifikaten zu tun hat und wie ich sie erzeuge. Was ich bisher getan:
- Erstellen Sie ein neues Verteilungszertifikat
- eine neue APS-Produktion Zertifikat erstellen
- eine Ad-hoc-Verteilung erstellen Profil Bereitstellung
- Installieren Sie alle auf meinem Mac
- die archivierten App, die die Signatur des Verteilungszertifikatscode und das Adhoc-Bereitstellungsprofil verwendet.
- Export für Ad-hoc-Verteilung
- Installieren Sie die App auf einem autorisierten Gerät
- Exportiert eine P12-Datei aus dem Zertifikat privaten Schlüssel mit einem richtigen Passwort.
Hat jemand Probleme damit?