Сбой сети приложения магазина OSX Mac после кода/пакета

У меня есть приложение, созданное в Unity и настроенное для выпуска в Mac App Store, в котором есть сетевые задачи, которые отлично работают в сборке OS X, которая не для магазина приложений, а после того, как сборка, требующая проверки/кодирования магазина приложений, сделана сеть не работает. Приложение и процесс сборки работали не так давно, но теперь не работают.

Я включаю сетевые разрешения в права и не вижу никаких следов ошибки песочницы в системной консоли. Сетевые вызовы с покупкой в ​​​​приложении проходят успешно, но если я проверяю трафик на что-либо еще в терминале, данные не передаются и не передаются.

Поэтому мне было интересно, есть ли у кого-нибудь идеи о том, что может быть причиной этого или дальнейших тестов, которые я мог бы использовать, чтобы выяснить, в чем может быть проблема.


person AlexTheMighty    schedule 17.03.2016    source источник
comment
какие плагины вы используете? а какие фреймворки вы добавляете в xcode? какие сетевые задачи? простые запросы json или сокеты или что? пожалуйста, уточните, чтобы увеличить шансы на получение поддержки, и чтобы нам было легче вам помочь.   -  person DeyaEldeen    schedule 29.03.2016
comment
Единственный плагин — это Unity IAP, никакие фреймворки не добавляются через Xcode (на самом деле Xcode вообще не используется). Сеть Я пытаюсь подключиться к Parse, но я также пробовал просто WWW-вызовы на тестовые сайты, и ничего не получается.   -  person AlexTheMighty    schedule 07.04.2016
comment
@AlexTheMighty У меня та же проблема с Unity 5.3.4p1. Вы когда-нибудь находили решение?   -  person Andrew Garrison    schedule 10.05.2016
comment
@AndrewGarrison, к сожалению, еще нет. Я понял, что проблема каким-то образом связана с ошибкой HTTPS, но я не уверен, что именно происходит, чтобы изменить работающую сборку OS X на неисправную версию Mac App Store.   -  person AlexTheMighty    schedule 11.05.2016


Ответы (1)


Я так и не понял, что не так с WWW-классом Unity, но мне удалось обойти проблему с помощью класса System.Net.WebClient. Я реализовал простую оболочку с интерфейсом, аналогичным WWW-классу Unity. Вот код, который я использовал:

using System;
using System.Net;
using System.Net.Security;
using System.Text;

/// <summary>
/// Web request using the WebClient class.
/// </summary>
/// <seealso cref="Assets.Scripts.WebRequest" />
internal class WebRequest
{
   /// <summary>
   /// The web client.
   /// </summary>
   private WebClient _client;

   /// <summary>
   /// The error message.
   /// </summary>
   private string _error;

   /// <summary>
   /// The is done flag.
   /// </summary>
   private bool _isDone;

   /// <summary>
   /// The progress.
   /// </summary>
   private float _progress;

   /// <summary>
   /// The text.
   /// </summary>
   private string _text;

   /// <summary>
   /// Initializes a new instance of the <see cref="WebRequest"/> class.
   /// </summary>
   /// <param name="url">The URL.</param>
   public WebRequest(string url)
   {
      this._client = new System.Net.WebClient();
      this._client.DownloadProgressChanged += this.WebClientProgressChanged;
      this._client.DownloadStringCompleted += this.WebClientDownloadCompleted;
      this._client.DownloadStringAsync(new Uri(url));
   }

   /// <summary>
   /// Initializes a new instance of the <see cref="WebRequestDotNet"/> class.
   /// </summary>
   /// <param name="url">The URL.</param>
   /// <param name="form">The form.</param>
   public WebRequest(string url, UnityEngine.WWWForm form)
   {
      this._client = new System.Net.WebClient();
      this._client.UploadProgressChanged += this.WebClientUploadProgressChanged;
      this._client.UploadDataCompleted += this.WebClientUploadCompleted;

      this._client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";

      // Try to get the header from the Unity form
      foreach (var header in form.headers)
      {
         const string ContentType = "Content-Type";
         if (header.Key == ContentType)
         {
            string contentType = header.Value;
            this._client.Headers.Remove(ContentType);
            this._client.Headers[ContentType] = contentType;
         }
      }

      this._client.UploadDataAsync(new Uri(url), form.data);
   }

   /// <summary>
   /// Gets the error message. Returns null if there is no error.
   /// </summary>
   /// <value>
   /// The error message.
   /// </value>
   public string Error
   {
      get
      {
         return this._error;
      }
   }

   /// <summary>
   /// Gets a value indicating whether this request is done.
   /// </summary>
   /// <value>
   ///   <c>true</c> if this instance is done; otherwise, <c>false</c>.
   /// </value>
   public bool IsDone
   {
      get
      {
         return this._isDone;
      }
   }

   /// <summary>
   /// Gets the progress, 0 to 1.
   /// </summary>
   /// <value>
   /// The progress.
   /// </value>
   public float Progress
   {
      get
      {
         return this._progress / 100.0f;
      }
   }

   /// <summary>
   /// Gets the resulting text.
   /// </summary>
   /// <value>
   /// The text.
   /// </value>
   public string Text
   {
      get
      {
         return this._text;
      }
   }

   /// <summary>
   /// Called when the download is complete.
   /// </summary>
   /// <param name="sender">The sender.</param>
   /// <param name="e">The <see cref="DownloadStringCompletedEventArgs"/> instance containing the event data.</param>
   private void WebClientDownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
   {
      if (e.Error != null)
      {
         this._error = e.Error.ToString();
      }
      else
      {
         this._text = e.Result;
      }

      this._isDone = true;
   }

   /// <summary>
   /// Called when the progress changes.
   /// </summary>
   /// <param name="sender">The sender.</param>
   /// <param name="e">The <see cref="DownloadProgressChangedEventArgs"/> instance containing the event data.</param>
   private void WebClientProgressChanged(object sender, DownloadProgressChangedEventArgs e)
   {
      this._progress += e.ProgressPercentage;
   }

   /// <summary>
   /// Called when the upload is complete.
   /// </summary>
   /// <param name="sender">The sender.</param>
   /// <param name="e">The <see cref="UploadValuesCompletedEventArgs"/> instance containing the event data.</param>
   private void WebClientUploadCompleted(object sender, UploadDataCompletedEventArgs e)
   {
      if (e.Error != null)
      {
         this._error = e.Error.ToString();
      }
      else
      {
         this._text = Encoding.UTF8.GetString(e.Result);
      }

      this._isDone = true;
   }

   /// <summary>
   /// Called when the upload progress changes.
   /// </summary>
   /// <param name="sender">The sender.</param>
   /// <param name="e">The <see cref="UploadProgressChangedEventArgs"/> instance containing the event data.</param>
   private void WebClientUploadProgressChanged(object sender, UploadProgressChangedEventArgs e)
   {
      this._progress += e.ProgressPercentage;
   }
}
person Andrew Garrison    schedule 01.06.2016