- Home /
WWW class is empty on iOS
I have some networking code using Unity's WWW class that reads data from a remote server. It works fine in the editor, but when I try it from an iPad the www object is completely empty - no headers, no error, nothing. Here's a stripped down version of what I'm doing:
WWW www;
public void StartLogin (string username, string password)
{
WWWForm form = new WWWForm();
form.AddField("username", username);
Hashtable headers = form.headers;
headers["username"] = username;
headers["password"] = password;
headers["deviceId"] = 2;
www = new WWW(loginUrl, form.data, headers);
//StartCoroutine(WaitForLoginRequest());
}
void Update()
{
if (www != null && www.isDone)
{
DoLoginRequest();
}
}
void DoLoginRequest()
{
//Code goes here
www = null;
}
As you can see, I started using coroutines, but switched over to a simpler version using Update (didn't help). I know the connection is getting through to the server because it's logging an error 412 - I can fix that, but I'm more worried about where all my information is going on the iOS side.
Update - I realised that the response text was supposed to be empty. So the big question becomes "do response headers work on iOS"?
Answer by SimonW · Jun 27, 2012 at 09:46 PM
And the answer is no, response headers seem to be completely broken on iOS. If anyone else hits this problem, I suggest not using them.
Sir did you got solution? plz help. i am also get stuck in it...
Your answer
Follow this Question
Related Questions
[iOS] WWW class sometimes doesn't return a response 0 Answers
iOS use WWW to access StreamingAssets get erro 1009 1 Answer
Spawing Hololens Camera OR ARCamera at user defined spawn locations 0 Answers
Get the device IP address from Unity 3 Answers
how to give Unity feedback on classes in Experimental ? 0 Answers