WWW class not working on iPad

When I send out a request using the WWW class I retrieve the server response as echo’ed output from WWW.text.

My class works fine on all devices except iOS, I have tracked down the problem to www.isDone. It appears to not detect when the download is completed and it gets hung up in the while loop. This causes iOS to freeze indefinitely.

public class HTTP  {
	
	public HTTP(string request, out string result)
	{
		result = ServerRequest(request);	
	}
	
	private IEnumerator DownloadString( string url )
	{
    	WWW www = new WWW( url );
		while(!www.isDone)
		{
			//Do Nothing, wait for download to finish
		}
    
		yield return www.text;
	}
	
	private string ServerRequest(string request)
	{
		string result = null;
		IEnumerator e;

		//Send a RESTful server Request
		e = DownloadString(request);
 		
		//get the last result of the enumeration
		while(e.MoveNext()) 
		{
			result =  e.Current.ToString();
  		}
		
		//check for server response errors
		if(isServerResponseError(result))
		{
			Debug.LogError(result);
			return null;
		}
  		Debug.Log ("Downloaded string: " + result); //write to log for string verification
		return result;
	}
	
	private bool isServerResponseError(string www)
	{
		if(www.Contains("Error:"))
		{
			return true;	
		}
		
		return false;
	}
}

The WWW request gets processed in the main thread, so the while loop prevents the request from getting processed, you need to yield until the request finishes.