In class Http I create method for POST and GET requests (wrapper for WWW with IEnumerator). In another method I make 20 GET requests in cycle. As result : In Unity Player it's work fine, on android - fine, but on iOS I get crash in different places without any stack traces. Anybody know what I doing wrong?
public void POST(string url, byte[] data, Action callback, string id = null)
{
WWW www = null;
if (!String.IsNullOrEmpty(id))
{
Hashtable headers = new Hashtable();
headers.Add("CACHE_ID", id);
www = new WWW(url, data, headers);
}
www = new WWW(url, data);
StartCoroutine(WaitForRequest(www, callback));
}
private IEnumerator WaitForRequest(WWW www, Action callback)
{
yield return www;
// check for errors
if (String.IsNullOrEmpty(www.error))
{
Debug.Log("WWW loading Ok!: " + www.url);
} else {
Debug.Log("WWW Error: " + www.error);
}
Debug.Log("!!! Callback: " + callback.ToString());
callback(www);
}
public void GET(string url, Action callback)
{
WWW www = new WWW (url);
StartCoroutine (WaitForRequest (www, callback));
}
↧