Не удается отправить push-уведомления через pushsharp при раздаче adhoc

Я использую PushSharp для отправки уведомлений iOS в приложение.

Мне удалось заставить его работать в среде разработки, следуя примеру, но когда я пытаюсь отправить их в производственной среде, я получаю следующую ошибку:

InnerException = {"No se pudo realizar una llamada a SSPI; consulte la excepción interna."
{"SSL Stream Failed to Authenticate as Client"}

Вот код:

 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 ();

Я почти уверен, что это как-то связано с сертификатами и тем, как их генерировать. Что я сделал до сих пор:

  • Создайте новый сертификат распространения
  • Создайте новый производственный сертификат APS
  • Создание специального профиля обеспечения распространения
  • Установить все на мой Mac
  • Приложение заархивировано с использованием подписи кода сертификата распространения и специального профиля подготовки.
  • Экспортируйте его для специального распространения
  • Установите приложение на авторизованное устройство
  • Экспортирован файл .p12 из закрытого ключа сертификата с правильным паролем.

Были ли у кого-то проблемы с ним?


person lerp90    schedule 23.06.2016    source источник


Ответы (1)


Наконец-то я заработал, экспортировав только сертификат в файл .p12, а затем используя этот файл с PushSharp.

person lerp90    schedule 26.06.2016