- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
EngRobertoFernandes · Nov 14, 2013 at 05:46 PM ·
ioswww
www class works fine in android but doesn't work in ios...
I have a function using Unity's WWW class that reads the data from a web server and return's the www.text. Is a easy as that, except that it doesn't work in IOS but works fine in android. In IOS it blocks in cycle while(!www.isDone){ ... }
Here's the function that suppossedly returns the web server content:
private static string GetHttpRequest(string link){
WWW www = new WWW(link);
float elapsedTime = Time.time;
while (!www.isDone){
if (Time.time >= elapsedTime + 4.0f) {
Debug.LogError("HttpRequest Timeout");
return "";
};
}
if (!www.isDone || !string.IsNullOrEmpty(www.error)) {
Debug.LogError(string.Format("Error!\n{0}", www.error));
return "";
}
string response = www.text;
return response;
}
Is there a better way of doing this? without using the WWW class? thanks
Comment