Post to server but do not get expected returns

I developed a game, Alien Checkers, it works perfectly on Android and on the Web, but when I put it on an i-Pad, the multi-player part of the game does not work. I use a form and post information to some php code on a server. In iOS the post goes through but it does not seem to return the expected information. For example I posted my create new user code below. On the iPad I can create a new user, I know because I look at the data base and the new user is there, but you wouldn’t know from trying it on the iPad because this line of code:
Application.LoadLevel("onlinesetupmenu"); is never executed so the game just sits there appearing to do nothing. It is happens like this for my other WWW calls as well. If you want to try the game to see what I’m talking about you can play for free
alien checkers You see that if you create a new user you should be brought to another screen where you can challenge other players to games.

I know that was a lot so I’ll summarize with these bullets
On the iPad

  • successfully post data to database
  • do not get the expected returns, so in this case I am not brought to the new level / Screen

What am I doing wrong here? Once again this is my first try with iOS so I’m hoping it’s something simple.

Here is the full snippet

private IEnumerator CreateNewUserDB(string myUsername, string myPassword, string myEmail ,int myColor){
		var form = new WWWForm();
		form.AddField( "password", "******");
		form.AddField( "username", myUsername);
		form.AddField( "userpassword",myPassword);
		form.AddField ("email",myEmail);
		form.AddField ("color",myColor);
		WWW download = new WWW( "http://www.aliencheckers.com/createnewuser.php",form);
		yield return download;
		if( download.error != null) {
			print( "Error downloading: " + download.error );
		} else {
			PlayerPrefs.SetInt("LoggedIn",1);
			PlayerPrefs.SetString ("loggedinplayer",myUsername);
			PlayerPrefs.SetString("PlayerOne",myUsername);
			PlayerPrefs.SetString("password",myPassword);
			char[] delimiterChars = {':'};
			string[] usertable = download.text.Split(delimiterChars);
			print (usertable[0]);
			if(usertable[0] == "successful login"){
				if (rememberMe){
					PlayerPrefs.SetInt("RememberUser",1);
					PlayerPrefs.SetString("RememberUserName",myUsername);
					PlayerPrefs.SetString("RememberPassword",myPassword);
				}
				else{
					PlayerPrefs.SetInt("RememberUser",0);
					PlayerPrefs.SetString("RememberPassword",myPassword);
				}
				Application.LoadLevel("onlinesetupmenu");
			}
			else{
				nameErrorMsg = "this name is taken\n please choose another name";
			}
		}
	}

Replace

if( download.error != null)

with

if( !String.IsNullOrEmpty(download.error))

and see if it works any better

oh - totally this! 8) There were some changes in how we treat strings from native-to-mono internally along with WWW impl changes - so now you should check WWW.error in “proper” way, as in String.IsNullOrEmpty

My problem was solved by upgrading from 4.3.3 to Unity 4.3.4 :slight_smile:
But now I’m reading this ^^ :slight_smile: So I will also replace my if statement with the “proper” check :slight_smile: Thanks you both!!! I heart Unity Forums!